{"thread":{"id":"9358","subject":"[StGIT PATCH 0/6] Various contrib/ updates","startedAt":"2007-08-02T20:18:10Z","lastAt":"2007-08-20T17:24:22Z","messageCount":8,"participants":["Yann Dirson","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"49464","messageId":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","threadId":"9358","inReplyTo":null,"subject":"[StGIT PATCH 0/6] Various contrib/ updates","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-08-02T20:18:10Z","receivedAt":"2007-08-02T20:18:10Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"This series, asside from small fixes, enhance the bash completion to\nbe aware of file status (notably, makes it much more comfortable to\nrefresh only selective files), and introduces 2 new contrib scripts:\n\n- whereas stg-fold-files-from was designed to merge in the current\npatch changes from several other patches, stg-dispatch makes life\neasier to split a given patch into several other ones (ie. making a\nsplit series out of a monolithic patch).\n\n- stg-show is a RFC/proof-of-concept for a redesign of \"stg show\",\nwhich calls git-show much more transparently.  This allows to harness\nthe full power of the git-show command-line without duplicating the\nlogic in stgit.\n\n\nI already made heavy use of the scripts in the last days, and I rate\nthem as good candidates for 0.13.1.\n\n-- \nYann Dirson    <ydirson@altern.org> |\nDebian-related: <dirson@debian.org> |   Support Debian GNU/Linux:\n                                    |  Freedom, Power, Stability, Gratis\n     http://ydirson.free.fr/        | Check <http://www.debian.org/>\n"},{"id":"49465","messageId":"20070802201815.16614.75785.stgit@gandelf.nowhere.earth","threadId":"9358","inReplyTo":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 1/6] Improve stg-fold-files-from doc.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-08-02T20:18:15Z","receivedAt":"2007-08-02T20:18:15Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-fold-files-from |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/stg-fold-files-from b/contrib/stg-fold-files-from\nindex bfb4a1f..53d3d02 100755\n--- a/contrib/stg-fold-files-from\n+++ b/contrib/stg-fold-files-from\n@@ -2,12 +2,12 @@\n set -e\n \n # stg-fold-files-from - picks changes to one file from another patch.\n-# Only supports picking from one file, but allows to select any range\n+# Only supports picking from one file pattern, but allows to select any range\n # of hunks from the file, using the -# flag to filterdiff.\n # Use together with \"filterdiff --annotate\" in your diff pager, to\n # identify hunk numbers easily.\n \n-# usage: stg-fold-files-from <patch> [-#<n>[-<n>][,<n>]...] <file>\n+# usage: stg-fold-files-from <patch> [-#<n>[-<n>][,<n>]...] <file-pattern>\n \n # Copyright (c) 2006-2007 Yann Dirson <ydirson@altern.org>\n # Subject to the GNU GPL, version 2.\n"},{"id":"49466","messageId":"20070802201821.16614.87841.stgit@gandelf.nowhere.earth","threadId":"9358","inReplyTo":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 2/6] New contrib scripts: stg-dispatch and stg-show.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-08-02T20:18:21Z","receivedAt":"2007-08-02T20:18:21Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-dispatch |   34 ++++++++++++++++++++++++++++++++++\n contrib/stg-show     |   27 +++++++++++++++++++++++++++\n 2 files changed, 61 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/stg-dispatch b/contrib/stg-dispatch\nnew file mode 100755\nindex 0000000..8911946\n--- /dev/null\n+++ b/contrib/stg-dispatch\n@@ -0,0 +1,34 @@\n+#!/bin/sh\n+set -e\n+\n+# stg-dispatch - percollates files matching a pattern down to another patch.\n+# It does the same job as stg-fold-files-from (and makes use of it to\n+# do so), but from the patch containing the changes to migrate,\n+# instead of doing so from the target patch.\n+\n+# usage: stg-dispatch <topatch> [-#<n>[-<n>][,<n>]...] <file-pattern>\n+\n+# Copyright (c) 2007 Yann Dirson <ydirson@altern.org>\n+# Subject to the GNU GPL, version 2.\n+\n+die()\n+{\n+    echo >&2 \"$(basename $0) error: $*\"\n+    exit 1\n+}\n+\n+TOPATCH=\"$1\"\n+shift\n+\n+stg applied | grep \"^$TOPATCH\\$\" >/dev/null ||\n+    die \"cannot dispatch to unapplied patch '$TOPATCH'\"\n+\n+CURRENTPATCH=$(stg top)\n+\n+[ \"x$TOPATCH\" != \"x$CURRENTPATCH\" ] ||\n+    die \"dispatching to current patch ($CURRENTPATCH) makes no sense\"\n+\n+stg goto \"$TOPATCH\"\n+stg-fold-files-from \"$CURRENTPATCH\" \"$@\"\n+stg refresh\n+stg goto \"$CURRENTPATCH\"\ndiff --git a/contrib/stg-show b/contrib/stg-show\nnew file mode 100755\nindex 0000000..8c61540\n--- /dev/null\n+++ b/contrib/stg-show\n@@ -0,0 +1,27 @@\n+#!/bin/bash\n+set -e\n+\n+# stg-show - unlike \"stg show\", just \"git show\" with knowledge of stg refs\n+\n+# Ex:\n+# stg-show --color-words -- files\n+\n+# Copyright (c) 2007 Yann Dirson <ydirson@altern.org>\n+# Subject to the GNU GPL, version 2.\n+\n+command=(git show)\n+\n+# subsitute git id's for stg ones until --\n+endofpatches=0\n+while [ \"$#\" -gt 0 ]; do\n+    case \"$1\" in\n+\t--) endofpatches=1; break ;;\n+\t-*) command+=(\"$1\"); shift ;;\n+\t*) command+=( $(stg id \"$1\" 2>/dev/null || echo \"$1\") ); shift ;;\n+    esac\n+done\n+\n+# append remaining args\n+command+=(\"$@\")\n+\n+eval \"${command[@]}\"\n"},{"id":"49467","messageId":"20070802201826.16614.19867.stgit@gandelf.nowhere.earth","threadId":"9358","inReplyTo":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 3/6] Add -O flag to stg-fold-files-from.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-08-02T20:18:26Z","receivedAt":"2007-08-02T20:18:26Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-fold-files-from |   14 +++++++++-----\n 1 files changed, 9 insertions(+), 5 deletions(-)\n\ndiff --git a/contrib/stg-fold-files-from b/contrib/stg-fold-files-from\nindex 53d3d02..806a157 100755\n--- a/contrib/stg-fold-files-from\n+++ b/contrib/stg-fold-files-from\n@@ -1,4 +1,4 @@\n-#!/bin/sh\n+#!/bin/bash\n set -e\n \n # stg-fold-files-from - picks changes to one file from another patch.\n@@ -6,8 +6,9 @@ set -e\n # of hunks from the file, using the -# flag to filterdiff.\n # Use together with \"filterdiff --annotate\" in your diff pager, to\n # identify hunk numbers easily.\n+# Use \"-O -U<n>\" to get finer hunk granularity for -#<n>.\n \n-# usage: stg-fold-files-from <patch> [-#<n>[-<n>][,<n>]...] <file-pattern>\n+# usage: stg-fold-files-from <patch> [-O <stg-show-flags>] [-#<n>[-<n>][,<n>]...] <file-pattern>\n \n # Copyright (c) 2006-2007 Yann Dirson <ydirson@altern.org>\n # Subject to the GNU GPL, version 2.\n@@ -18,14 +19,17 @@ shift\n filtercmd=cat\n hunks=\n foldflags=\n+showflags=()\n while [ \"$#\" -gt 0 ]; do\n     case \"$1\" in\n-\t-\\#*) hunks=\"$1\"; shift ;;\n-\t-t) foldflags=\"-t\"; shift ;;\n+\t-\\#*) hunks=\"$1\" ;;\n+\t-t) foldflags=\"-t\" ;;\n+\t-O) showflags+=(-O \"$2\"); shift ;;\n \t-*) { echo >&2 \"unknown flag '$1'\"; exit 1; } ;;\n \t*) break ;;\n     esac\n+    shift\n done\n [ \"$#\" = 1 ] || { echo >&2 \"supports one file only\"; exit 1; }\n \n-stg show \"$PATCH\" | filterdiff -p1 $hunks -i \"$1\" | stg fold $foldflags\n+stg show \"${showflags[@]}\" \"$PATCH\" | filterdiff -p1 $hunks -i \"$1\" | stg fold $foldflags\n"},{"id":"49469","messageId":"20070802201831.16614.33481.stgit@gandelf.nowhere.earth","threadId":"9358","inReplyTo":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 4/6] Add a no-act flag to stg-dispatch and stg-fold-file-from.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-08-02T20:18:31Z","receivedAt":"2007-08-02T20:18:31Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"From: Yann Dirson <yann.dirson@sagem.com>\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-dispatch        |   20 +++++++++++++++-----\n contrib/stg-fold-files-from |   15 +++++++++++++--\n 2 files changed, 28 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/stg-dispatch b/contrib/stg-dispatch\nindex 8911946..e9cfb05 100755\n--- a/contrib/stg-dispatch\n+++ b/contrib/stg-dispatch\n@@ -6,7 +6,7 @@ set -e\n # do so), but from the patch containing the changes to migrate,\n # instead of doing so from the target patch.\n \n-# usage: stg-dispatch <topatch> [-#<n>[-<n>][,<n>]...] <file-pattern>\n+# usage: stg-dispatch [-n] <topatch> [-#<n>[-<n>][,<n>]...] <file-pattern>\n \n # Copyright (c) 2007 Yann Dirson <ydirson@altern.org>\n # Subject to the GNU GPL, version 2.\n@@ -17,6 +17,12 @@ die()\n     exit 1\n }\n \n+noact=0\n+if [ \"x$1\" = \"x-n\" ]; then\n+    noact=1\n+    shift\n+fi\n+\n TOPATCH=\"$1\"\n shift\n \n@@ -28,7 +34,11 @@ CURRENTPATCH=$(stg top)\n [ \"x$TOPATCH\" != \"x$CURRENTPATCH\" ] ||\n     die \"dispatching to current patch ($CURRENTPATCH) makes no sense\"\n \n-stg goto \"$TOPATCH\"\n-stg-fold-files-from \"$CURRENTPATCH\" \"$@\"\n-stg refresh\n-stg goto \"$CURRENTPATCH\"\n+if [ $noact = 1 ]; then\n+    stg-fold-files-from \"$CURRENTPATCH\" -n \"$@\"\n+else\n+    stg goto \"$TOPATCH\"\n+    stg-fold-files-from \"$CURRENTPATCH\" \"$@\"\n+    stg refresh\n+    stg goto \"$CURRENTPATCH\"\n+fi\ndiff --git a/contrib/stg-fold-files-from b/contrib/stg-fold-files-from\nindex 806a157..c52abfc 100755\n--- a/contrib/stg-fold-files-from\n+++ b/contrib/stg-fold-files-from\n@@ -8,7 +8,7 @@ set -e\n # identify hunk numbers easily.\n # Use \"-O -U<n>\" to get finer hunk granularity for -#<n>.\n \n-# usage: stg-fold-files-from <patch> [-O <stg-show-flags>] [-#<n>[-<n>][,<n>]...] <file-pattern>\n+# usage: stg-fold-files-from <patch> [-n] [-O <stg-show-flags>] [-#<n>[-<n>][,<n>]...] <file-pattern>\n \n # Copyright (c) 2006-2007 Yann Dirson <ydirson@altern.org>\n # Subject to the GNU GPL, version 2.\n@@ -20,10 +20,12 @@ filtercmd=cat\n hunks=\n foldflags=\n showflags=()\n+noact=0\n while [ \"$#\" -gt 0 ]; do\n     case \"$1\" in\n \t-\\#*) hunks=\"$1\" ;;\n \t-t) foldflags=\"-t\" ;;\n+\t-n) noact=1 ;;\n \t-O) showflags+=(-O \"$2\"); shift ;;\n \t-*) { echo >&2 \"unknown flag '$1'\"; exit 1; } ;;\n \t*) break ;;\n@@ -32,4 +34,13 @@ while [ \"$#\" -gt 0 ]; do\n done\n [ \"$#\" = 1 ] || { echo >&2 \"supports one file only\"; exit 1; }\n \n-stg show \"${showflags[@]}\" \"$PATCH\" | filterdiff -p1 $hunks -i \"$1\" | stg fold $foldflags\n+getpatch()\n+{\n+    stg show \"${showflags[@]}\" \"$PATCH\" | filterdiff -p1 $hunks -i \"$1\"\n+}\n+\n+if [ $noact = 1 ]; then\n+    getpatch \"$1\"\n+else\n+    getpatch \"$1\" | stg fold $foldflags\n+fi\n"},{"id":"49468","messageId":"20070802201836.16614.49897.stgit@gandelf.nowhere.earth","threadId":"9358","inReplyTo":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 5/6] Provide file completion for add/resolved/refresh based on status.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-08-02T20:18:36Z","receivedAt":"2007-08-02T20:18:36Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"Signed-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stgit-completion.bash |   35 ++++++++++++++++++++++++++++++++++-\n 1 files changed, 34 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/stgit-completion.bash b/contrib/stgit-completion.bash\nindex a843db4..2d0d5f2 100644\n--- a/contrib/stgit-completion.bash\n+++ b/contrib/stgit-completion.bash\n@@ -111,6 +111,30 @@ _all_branches ()\n     [ \"$g\" ] && (cd .git/patches/ && echo *)\n }\n \n+_conflicting_files ()\n+{\n+    local g=$(_gitdir)\n+    [ \"$g\" ] && stg status --conflict\n+}\n+\n+_dirty_files ()\n+{\n+    local g=$(_gitdir)\n+    [ \"$g\" ] && stg status --modified --new --deleted\n+}\n+\n+_unknown_files ()\n+{\n+    local g=$(_gitdir)\n+    [ \"$g\" ] && stg status --unknown\n+}\n+\n+_known_files ()\n+{\n+    local g=$(_gitdir)\n+    [ \"$g\" ] && git ls-files\n+}\n+\n # List the command options\n _cmd_options ()\n {\n@@ -162,6 +186,11 @@ _complete_options ()\n     COMPREPLY=($(compgen -W \"$options\" -- \"${COMP_WORDS[COMP_CWORD]}\"))\n }\n \n+_complete_files ()\n+{\n+    COMPREPLY=($(compgen -W \"$(_cmd_options $1) $2\" -- \"${COMP_WORDS[COMP_CWORD]}\"))\n+}\n+\n _stg_common ()\n {\n     _complete_options \"$(_cmd_options $1)\"\n@@ -223,12 +252,16 @@ _stg ()\n         log)    _stg_patches $command _all_patches ;;\n         mail)   _stg_patches $command _all_patches ;;\n         pick)   _stg_patches $command _unapplied_patches ;;\n-        refresh)_stg_patches_options $command _applied_patches \"-p --patch\" ;;\n+#\trefresh)_stg_patches_options $command _applied_patches \"-p --patch\" ;;\n+        refresh) _complete_files $command \"$(_dirty_files)\" ;;\n         rename) _stg_patches $command _all_patches ;;\n         show)   _stg_patches $command _all_patches ;;\n         sync)   _stg_patches $command _applied_patches ;;\n         # working-copy commands\n         diff)   _stg_patches_options $command _applied_patches \"-r --range\" ;;\n+\tresolved) _complete_files $command \"$(_conflicting_files)\" ;;\n+\tadd)\t_complete_files $command \"$(_unknown_files)\" ;;\n+#\trm)\t_complete_files $command \"$(_known_files)\" ;;\n \t# commands that usually raher accept branches\n \tbranch) _complete_branch $command _all_branches ;;\n \trebase) _complete_branch $command _all_branches ;;\n"},{"id":"49470","messageId":"20070802201841.16614.85746.stgit@gandelf.nowhere.earth","threadId":"9358","inReplyTo":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 6/6] Fixed completion function hardcoding .git/.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-08-02T20:18:41Z","receivedAt":"2007-08-02T20:18:41Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"Signed-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stgit-completion.bash |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/stgit-completion.bash b/contrib/stgit-completion.bash\nindex 2d0d5f2..7ae9e6a 100644\n--- a/contrib/stgit-completion.bash\n+++ b/contrib/stgit-completion.bash\n@@ -108,7 +108,7 @@ _all_other_patches ()\n _all_branches ()\n {\n     local g=$(_gitdir)\n-    [ \"$g\" ] && (cd .git/patches/ && echo *)\n+    [ \"$g\" ] && (cd $g/patches/ && echo *)\n }\n \n _conflicting_files ()\n"},{"id":"51096","messageId":"b0943d9e0708201024m2961599fpde58e215ef0f454c@mail.gmail.com","threadId":"9358","inReplyTo":"20070802200704.16614.57993.stgit@gandelf.nowhere.earth","subject":"Re: [StGIT PATCH 0/6] Various contrib/ updates","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-08-20T17:24:22Z","receivedAt":"2007-08-20T17:24:22Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 02/08/07, Yann Dirson <ydirson@altern.org> wrote:\n> This series, asside from small fixes, enhance the bash completion to\n> be aware of file status (notably, makes it much more comfortable to\n> refresh only selective files), and introduces 2 new contrib scripts:\n\nThanks.\n\n> I already made heavy use of the scripts in the last days, and I rate\n> them as good candidates for 0.13.1.\n\nShould we keep 0.13.1 a bug-fix release only? I.e. not adding the new\ncontrib scripts.\n\n-- \nCatalin\n"}]}