{"thread":{"id":"8724","subject":"[StGIT PATCH 0/7] My patchqueue for 0.13.","startedAt":"2007-06-25T21:24:20Z","lastAt":"2007-06-25T21:24:56Z","messageCount":8,"participants":["Yann Dirson"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"45792","messageId":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":null,"subject":"[StGIT PATCH 0/7] My patchqueue for 0.13.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:20Z","receivedAt":"2007-06-25T21:24:20Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"The following series contains the fixes that were scattered in the\nmiddle of my refactoring series, but which I target at v0.13.\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":"45793","messageId":"20070625212426.17189.23900.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 1/7] Fix contrib/stg-whatchanged way of identifying a conflict.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:26Z","receivedAt":"2007-06-25T21:24:26Z","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/stg-whatchanged |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/stg-whatchanged b/contrib/stg-whatchanged\nindex d5b6965..a416e97 100755\n--- a/contrib/stg-whatchanged\n+++ b/contrib/stg-whatchanged\n@@ -24,7 +24,7 @@ fi\n # Merges via \"push\" leave top=bottom so we must look at old patch\n # in this case (unlike, eg., \"pick --fold\")\n patchdir=\"$(git-rev-parse --git-dir)/patches/$(stg branch)/patches/$(stg top)\"\n-if [ $(cat \"$patchdir/bottom\") = $(cat \"$patchdir/top\") ];\n+if [ -s \"$(git-rev-parse --git-dir)/conflicts\" ];\n then\n     current_cmd=\"stg show //top.old\"\n else\n"},{"id":"45795","messageId":"20070625212431.17189.38788.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 2/7] stg-cvs: update doc, and use correct setting for parent branch.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:31Z","receivedAt":"2007-06-25T21:24:31Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"This script had not been updated when we moved away from my wrong\ninterpretation of branch.*.merge.\n\nAt the same time, this includes some doc to set up a branch for use\nwith this command, and propotes design flaws to such, instead of\nleaving them hidden among mere limitation of the implementation.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-cvs |   36 +++++++++++++++++++++++++-----------\n 1 files changed, 25 insertions(+), 11 deletions(-)\n\ndiff --git a/contrib/stg-cvs b/contrib/stg-cvs\nindex 7b968d6..582f4f2 100755\n--- a/contrib/stg-cvs\n+++ b/contrib/stg-cvs\n@@ -14,15 +14,35 @@ set -e\n # - you want to add a \"CVS\" line to .git/info/exclude\n # - you may want to add a \".git\" line to the top .cvsignore\n \n+# BRANCH INIT\n+# - ensure the cvs wc is clean (eg. with \"cvsco\")\n+# $ git init\n+# $ echo CVS >> .git/info/exclude\n+# $ git add .\n+# $ git commit -m \"Initial import.\"\n+# $ git branch -m master cvs\n+# $ stg branch -c master cvs\n+# $ git config branch.master.stgit.parentbranch cvs (0.12.1 and earlier only)\n+# $ git config branch.cvs.description \"CVS $(cat CVS/Root) $(cat CVS/Repository) $(cat CVS/Tag 2>/dev/null | echo HEAD)\"\n+# $ git config branch.master.description \"Changes for $(cat CVS/Repository) $(cat CVS/Tag 2>/dev/null | echo HEAD)\"\n+\n # LIMITATIONS\n # - this is only a proof-of-concept prototype\n-# - lacks an \"init\" command\n+# - lacks an \"init\" command (see above)\n # - \"commit\" does not ensure the base is uptodate before trying to\n-#   commit (but hey, it's CVS ;)\n+#   commit (but hey, it's CVS ;): better \"stg-cvs pull\" first\n # - \"commit\" can only commit a single patch\n # - not much robustness here\n-# - still bad support for files removed in cvs (should catch \"no\n+# - still no support for files removed in cvs (should catch \"no\n #   longer in the repository\" message)\n+# - this only deals with CVS but could surely be extended to any other\n+#   VCS\n+# - lacks synchronisation of .cvsignore <-> .gitignore\n+# - no support for filenames with spaces (stg lacks --zero output format)\n+# - git-commit is too chatty when it finds nothing to commit\n+# - lacks a \"quick cvs commit\" feature\n+\n+# DESIGN FLAWS\n # - while fetching, if a file change was not git-update-index'd when\n #   cvs-update'd (eg. because of a stg-cvs bug), it is not seen on further\n #   fetches until it changes again, since we scan \"cvs update\" output.\n@@ -32,17 +52,11 @@ set -e\n #   already-existing in working copy, or to directory moves inside the\n #   cvs repository, or <fill here>) has to be dealt with by hand (although\n #   the situation is better here: cvs sees the conflict on subsequent tries)\n-# - this only deals with CVS but could surely be extended to any other\n-#   VCS\n # - bad/no support for cvsutils:\n #   - stg push/pop operations confuse cvsu because of timestamp changes\n #   - cvspurge/cvsco would nuke .git => does not make it easy to ensure\n #     synchronisation\n # - should use a separate workspace for cvs branch like tailor does\n-# - lacks synchronisation of .cvsignore <-> .gitignore\n-# - no support for filenames with spaces (stg lacks --zero output format)\n-# - git-commit is too chatty when it finds nothing to commit\n-# - lacks a \"quick cvs commit\" feature\n # - confused by cvs keyword substitution\n \n usage()\n@@ -102,8 +116,8 @@ cvs_add_dir()\n \n # get context\n branch=$(stg branch)\n-parent=$(git-repo-config \"branch.${branch}.merge\") || \n-    usage \"no declared parent for '$branch' - set branch.${branch}.merge\"\n+parent=$(git-config \"branch.${branch}.stgit.parentbranch\") || \n+    usage \"no declared parent for '$branch' - set branch.${branch}.stgit.parentbranch\"\n \n # extract command\n \n"},{"id":"45794","messageId":"20070625212436.17189.13221.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 3/7] Revert part of the reverted commit that we want to keep.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:36Z","receivedAt":"2007-06-25T21:24:36Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"- get rid of unused real_rebase parameter\n- revive git.all_refs()\n\nThis commit can freely be used to demonstrate the usefulness of\n_always_ separating different issues in different patches :)\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n stgit/commands/common.py |    2 +-\n stgit/commands/pull.py   |    2 +-\n stgit/commands/rebase.py |    2 +-\n stgit/git.py             |    6 ++++++\n 4 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/stgit/commands/common.py b/stgit/commands/common.py\nindex 22c78ae..b05979b 100644\n--- a/stgit/commands/common.py\n+++ b/stgit/commands/common.py\n@@ -318,7 +318,7 @@ def address_or_alias(addr_str):\n                  for addr in addr_str.split(',')]\n     return ', '.join([addr for addr in addr_list if addr])\n \n-def prepare_rebase(real_rebase, force=None):\n+def prepare_rebase(force=None):\n     if not force:\n         # Be sure we won't loose results of stg-(un)commit by error.\n         # Do not require an existing orig-base for compatibility with 0.12 and earlier.\ndiff --git a/stgit/commands/pull.py b/stgit/commands/pull.py\nindex 5f72f9b..fe3b67d 100644\n--- a/stgit/commands/pull.py\n+++ b/stgit/commands/pull.py\n@@ -86,7 +86,7 @@ def func(parser, options, args):\n     else:\n         raise GitConfigException, 'Unsupported pull-policy \"%s\"' % policy\n \n-    applied = prepare_rebase(real_rebase=must_rebase, force=options.force)\n+    applied = prepare_rebase(force=options.force)\n \n     # pull the remote changes\n     if policy == 'pull':\ndiff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py\nindex 2f0e660..e47772c 100644\n--- a/stgit/commands/rebase.py\n+++ b/stgit/commands/rebase.py\n@@ -56,7 +56,7 @@ def func(parser, options, args):\n     if git_id(args[0]) == None:\n         raise GitException, 'Unknown revision: %s' % git_id\n         \n-    applied = prepare_rebase(real_rebase=True, force=options.force)\n+    applied = prepare_rebase(force=options.force)\n     rebase(args[0])\n     post_rebase(applied, options.nopush, options.merged)\n \ndiff --git a/stgit/git.py b/stgit/git.py\nindex 02590a9..1f57481 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -1070,3 +1070,9 @@ def fetch_head():\n \n     # here we are sure to have a single fetch_head\n     return fetch_head\n+\n+def all_refs():\n+    \"\"\"Return a list of all refs in the current repository.\n+    \"\"\"\n+\n+    return [line.split()[1] for line in _output_lines(['git-show-ref'])]\n"},{"id":"45796","messageId":"20070625212441.17189.25324.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 4/7] Fixed thinko in error message.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:41Z","receivedAt":"2007-06-25T21:24: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 stgit/commands/rebase.py |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py\nindex e47772c..c68f8e7 100644\n--- a/stgit/commands/rebase.py\n+++ b/stgit/commands/rebase.py\n@@ -54,7 +54,7 @@ def func(parser, options, args):\n \n     # ensure an exception is raised before popping on non-existent target\n     if git_id(args[0]) == None:\n-        raise GitException, 'Unknown revision: %s' % git_id\n+        raise GitException, 'Unknown revision: %s' % args[0]\n         \n     applied = prepare_rebase(force=options.force)\n     rebase(args[0])\n"},{"id":"45797","messageId":"20070625212446.17189.45201.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 5/7] Changed sync not to use -b which has other semantics.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:46Z","receivedAt":"2007-06-25T21:24:46Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"Using --branch here is confusing from a UI point of view, and\nunnecessarily complicates implementation, making it more delicate to\nget rid of the crt-series global.  We now use --ref-branch (-B)\ninstead.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n stgit/commands/sync.py |   13 ++++++-------\n t/t2000-sync.sh        |    8 ++++----\n 2 files changed, 10 insertions(+), 11 deletions(-)\n\ndiff --git a/stgit/commands/sync.py b/stgit/commands/sync.py\nindex e769602..2ec7427 100644\n--- a/stgit/commands/sync.py\n+++ b/stgit/commands/sync.py\n@@ -38,7 +38,7 @@ The sync operation can be reverted for individual patches with --undo.\"\"\"\n options = [make_option('-a', '--all',\n                        help = 'synchronise all the patches',\n                        action = 'store_true'),\n-           make_option('-b', '--branch',\n+           make_option('-B', '--ref-branch',\n                        help = 'syncronise patches with BRANCH'),\n            make_option('-s', '--series',\n                        help = 'syncronise patches with SERIES'),\n@@ -69,9 +69,9 @@ def func(parser, options, args):\n     global crt_series\n \n     if options.undo:\n-        if options.branch or options.series:\n+        if options.ref_branch or options.series:\n             raise CmdException, \\\n-                  '--undo cannot be specified with --branch or --series'\n+                  '--undo cannot be specified with --ref-branch or --series'\n         __check_all()\n \n         out.start('Undoing the sync of \"%s\"' % crt_series.get_current())\n@@ -80,12 +80,11 @@ def func(parser, options, args):\n         out.done()\n         return\n \n-    if options.branch:\n+    if options.ref_branch:\n         # the main function already made crt_series to be the remote\n         # branch\n-        remote_series = crt_series\n-        stgit.commands.common.crt_series = crt_series = stack.Series()\n-        if options.branch == crt_series.get_name():\n+        remote_series = stack.Series(options.ref_branch)\n+        if options.ref_branch == crt_series.get_name():\n             raise CmdException, 'Cannot synchronise with the current branch'\n         remote_patches = remote_series.get_applied()\n \ndiff --git a/t/t2000-sync.sh b/t/t2000-sync.sh\nindex 69ab1ac..f831df7 100755\n--- a/t/t2000-sync.sh\n+++ b/t/t2000-sync.sh\n@@ -48,7 +48,7 @@ test_expect_success \\\n test_expect_success \\\n     'Synchronise second patch with the master branch' \\\n     '\n-    stg sync -b master p2 &&\n+    stg sync -B master p2 &&\n     [ \"$(echo $(stg applied))\" = \"p1 p2 p3\" ] &&\n     [ \"$(echo $(stg unapplied))\" = \"\" ] &&\n     test $(cat foo2.txt) = \"foo2\"\n@@ -57,7 +57,7 @@ test_expect_success \\\n test_expect_success \\\n     'Synchronise the first two patches with the master branch' \\\n     '\n-    stg sync -b master -a &&\n+    stg sync -B master -a &&\n     [ \"$(echo $(stg applied))\" = \"p1 p2 p3\" ] &&\n     [ \"$(echo $(stg unapplied))\" = \"\" ] &&\n     test $(cat foo1.txt) = \"foo1\" &&\n@@ -100,7 +100,7 @@ test_expect_success \\\n test_expect_success \\\n     'Synchronise second patch with the master branch' \\\n     '\n-    stg sync -b master p2 &&\n+    stg sync -B master p2 &&\n     [ \"$(echo $(stg applied))\" = \"p1 p2 p3\" ] &&\n     [ \"$(echo $(stg unapplied))\" = \"\" ] &&\n     test $(cat bar2.txt) = \"bar2\"\n@@ -109,7 +109,7 @@ test_expect_success \\\n test_expect_failure \\\n     'Synchronise the first two patches with the master branch (to fail)' \\\n     '\n-    stg sync -b master -a\n+    stg sync -B master -a\n     '\n \n test_expect_success \\\n"},{"id":"45798","messageId":"20070625212451.17189.21928.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 6/7] Fix t1200 to catch intermediate errors.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:51Z","receivedAt":"2007-06-25T21:24:51Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"All command sequences in tests should be linked with && or\nsimilar, to guard against potentially missing a regresssion.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n t/t1200-push-modified.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh\nindex 6769667..324b3b0 100755\n--- a/t/t1200-push-modified.sh\n+++ b/t/t1200-push-modified.sh\n@@ -21,9 +21,9 @@ test_create_repo foo\n test_expect_success \\\n     'Clone tree and setup changes' \\\n     \"stg clone foo bar &&\n-     (cd bar && stg new p1 -m p1\n+     (cd bar && stg new p1 -m p1 &&\n       printf 'a\\nc\\n' > file && stg add file && stg refresh &&\n-      stg new p2 -m p2\n+      stg new p2 -m p2 &&\n       printf 'a\\nb\\nc\\n' > file && stg refresh\n      )\n \"\n"},{"id":"45799","messageId":"20070625212456.17189.87831.stgit@gandelf.nowhere.earth","threadId":"8724","inReplyTo":"20070625212229.17189.79919.stgit@gandelf.nowhere.earth","subject":"[StGIT PATCH 7/7] If available, use gitk --argscmd in contrib/stg-gitk.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-06-25T21:24:56Z","receivedAt":"2007-06-25T21:24:56Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"This allows to ask gitk to recompute the list of patches to show at\nevery refresh.  Before this, we had problems with 'stg-gitk --all':\n\n - deleting a patch that was existing at startup time would trigger an\n \"unknown ref\" error from gitk and force to quit/restart manually;\n - patches created since startup were only visible when applied, or\n when below one of the startup patches.\n\nNote that --argscmd is not in official gitk yet, so we don't try to\nuse it if it's not available.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n contrib/stg-gitk |   36 +++++++++++++++++++++++++++++-------\n 1 files changed, 29 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/stg-gitk b/contrib/stg-gitk\nindex dd01ef0..6ddcfb1 100755\n--- a/contrib/stg-gitk\n+++ b/contrib/stg-gitk\n@@ -7,7 +7,6 @@ set -e\n # patch logs.\n \n # LIMITATIONS:\n-# - asking gitk to \"update\" won't detect any new ref\n # - no support for spaces in branch names\n \n # Copyright (c) 2007 Yann Dirson <ydirson@altern.org>\n@@ -20,11 +19,16 @@ usage()\n }\n \n allbranches=0\n-case \"$1\" in\n---all) allbranches=1; shift ;;\n---*) usage ;;\n-*) break ;;\n-esac\n+refsonly=0\n+while [ \"$#\" -gt 0 ]; do\n+    case \"$1\" in\n+\t--refs) refsonly=1 ;;\n+\t--all) allbranches=1 ;;\n+\t--*) usage ;;\n+\t*) break ;;\n+    esac\n+    shift\n+done\n \n if [ $allbranches = 1 ] && [ \"$#\" -gt 0 ]; then\n     usage\n@@ -58,4 +62,22 @@ else\n     done\n fi\n \n-gitk $(find $refdirs -type f -not -name '*.log' | cut -c${GIT_DIR_SPKIPLEN}- )\n+printrefs()\n+{\n+    find $refdirs -type f -not -name '*.log' | cut -c${GIT_DIR_SPKIPLEN}-\n+}\n+\n+if [ $refsonly = 1 ]; then\n+    printrefs\n+elif grep -q -- --argscmd $(which gitk); then\n+    # This gitk supports --argscmd.\n+    # Let's use a hack to pass --all, which was consumed during command-line parsing\n+    if [ $allbranches = 1 ]; then\n+\tgitk --argscmd=\"$0 --refs --all\"\n+    else\n+\tgitk --argscmd=\"$0 --refs $*\"\n+    fi\n+else\n+    # This gitk does not support --argscmd, just compute refs onces\n+    gitk $(printrefs)\n+fi\n"}]}