Git development
 help / color / mirror / Atom feed
* [StGIT PATCH 0/7] My patchqueue for 0.13.
@ 2007-06-25 21:24 Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 1/7] Fix contrib/stg-whatchanged way of identifying a conflict Yann Dirson
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

The following series contains the fixes that were scattered in the
middle of my refactoring series, but which I target at v0.13.

-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [StGIT PATCH 1/7] Fix contrib/stg-whatchanged way of identifying a conflict.
  2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
@ 2007-06-25 21:24 ` Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 2/7] stg-cvs: update doc, and use correct setting for parent branch Yann Dirson
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 contrib/stg-whatchanged |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/stg-whatchanged b/contrib/stg-whatchanged
index d5b6965..a416e97 100755
--- a/contrib/stg-whatchanged
+++ b/contrib/stg-whatchanged
@@ -24,7 +24,7 @@ fi
 # Merges via "push" leave top=bottom so we must look at old patch
 # in this case (unlike, eg., "pick --fold")
 patchdir="$(git-rev-parse --git-dir)/patches/$(stg branch)/patches/$(stg top)"
-if [ $(cat "$patchdir/bottom") = $(cat "$patchdir/top") ];
+if [ -s "$(git-rev-parse --git-dir)/conflicts" ];
 then
     current_cmd="stg show //top.old"
 else

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [StGIT PATCH 2/7] stg-cvs: update doc, and use correct setting for parent branch.
  2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 1/7] Fix contrib/stg-whatchanged way of identifying a conflict Yann Dirson
@ 2007-06-25 21:24 ` Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 3/7] Revert part of the reverted commit that we want to keep Yann Dirson
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

This script had not been updated when we moved away from my wrong
interpretation of branch.*.merge.

At the same time, this includes some doc to set up a branch for use
with this command, and propotes design flaws to such, instead of
leaving them hidden among mere limitation of the implementation.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 contrib/stg-cvs |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/contrib/stg-cvs b/contrib/stg-cvs
index 7b968d6..582f4f2 100755
--- a/contrib/stg-cvs
+++ b/contrib/stg-cvs
@@ -14,15 +14,35 @@ set -e
 # - you want to add a "CVS" line to .git/info/exclude
 # - you may want to add a ".git" line to the top .cvsignore
 
+# BRANCH INIT
+# - ensure the cvs wc is clean (eg. with "cvsco")
+# $ git init
+# $ echo CVS >> .git/info/exclude
+# $ git add .
+# $ git commit -m "Initial import."
+# $ git branch -m master cvs
+# $ stg branch -c master cvs
+# $ git config branch.master.stgit.parentbranch cvs (0.12.1 and earlier only)
+# $ git config branch.cvs.description "CVS $(cat CVS/Root) $(cat CVS/Repository) $(cat CVS/Tag 2>/dev/null | echo HEAD)"
+# $ git config branch.master.description "Changes for $(cat CVS/Repository) $(cat CVS/Tag 2>/dev/null | echo HEAD)"
+
 # LIMITATIONS
 # - this is only a proof-of-concept prototype
-# - lacks an "init" command
+# - lacks an "init" command (see above)
 # - "commit" does not ensure the base is uptodate before trying to
-#   commit (but hey, it's CVS ;)
+#   commit (but hey, it's CVS ;): better "stg-cvs pull" first
 # - "commit" can only commit a single patch
 # - not much robustness here
-# - still bad support for files removed in cvs (should catch "no
+# - still no support for files removed in cvs (should catch "no
 #   longer in the repository" message)
+# - this only deals with CVS but could surely be extended to any other
+#   VCS
+# - lacks synchronisation of .cvsignore <-> .gitignore
+# - no support for filenames with spaces (stg lacks --zero output format)
+# - git-commit is too chatty when it finds nothing to commit
+# - lacks a "quick cvs commit" feature
+
+# DESIGN FLAWS
 # - while fetching, if a file change was not git-update-index'd when
 #   cvs-update'd (eg. because of a stg-cvs bug), it is not seen on further
 #   fetches until it changes again, since we scan "cvs update" output.
@@ -32,17 +52,11 @@ set -e
 #   already-existing in working copy, or to directory moves inside the
 #   cvs repository, or <fill here>) has to be dealt with by hand (although
 #   the situation is better here: cvs sees the conflict on subsequent tries)
-# - this only deals with CVS but could surely be extended to any other
-#   VCS
 # - bad/no support for cvsutils:
 #   - stg push/pop operations confuse cvsu because of timestamp changes
 #   - cvspurge/cvsco would nuke .git => does not make it easy to ensure
 #     synchronisation
 # - should use a separate workspace for cvs branch like tailor does
-# - lacks synchronisation of .cvsignore <-> .gitignore
-# - no support for filenames with spaces (stg lacks --zero output format)
-# - git-commit is too chatty when it finds nothing to commit
-# - lacks a "quick cvs commit" feature
 # - confused by cvs keyword substitution
 
 usage()
@@ -102,8 +116,8 @@ cvs_add_dir()
 
 # get context
 branch=$(stg branch)
-parent=$(git-repo-config "branch.${branch}.merge") || 
-    usage "no declared parent for '$branch' - set branch.${branch}.merge"
+parent=$(git-config "branch.${branch}.stgit.parentbranch") || 
+    usage "no declared parent for '$branch' - set branch.${branch}.stgit.parentbranch"
 
 # extract command
 

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [StGIT PATCH 3/7] Revert part of the reverted commit that we want to keep.
  2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 1/7] Fix contrib/stg-whatchanged way of identifying a conflict Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 2/7] stg-cvs: update doc, and use correct setting for parent branch Yann Dirson
@ 2007-06-25 21:24 ` Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 4/7] Fixed thinko in error message Yann Dirson
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

- get rid of unused real_rebase parameter
- revive git.all_refs()

This commit can freely be used to demonstrate the usefulness of
_always_ separating different issues in different patches :)

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 stgit/commands/common.py |    2 +-
 stgit/commands/pull.py   |    2 +-
 stgit/commands/rebase.py |    2 +-
 stgit/git.py             |    6 ++++++
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 22c78ae..b05979b 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -318,7 +318,7 @@ def address_or_alias(addr_str):
                  for addr in addr_str.split(',')]
     return ', '.join([addr for addr in addr_list if addr])
 
-def prepare_rebase(real_rebase, force=None):
+def prepare_rebase(force=None):
     if not force:
         # Be sure we won't loose results of stg-(un)commit by error.
         # Do not require an existing orig-base for compatibility with 0.12 and earlier.
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 5f72f9b..fe3b67d 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -86,7 +86,7 @@ def func(parser, options, args):
     else:
         raise GitConfigException, 'Unsupported pull-policy "%s"' % policy
 
-    applied = prepare_rebase(real_rebase=must_rebase, force=options.force)
+    applied = prepare_rebase(force=options.force)
 
     # pull the remote changes
     if policy == 'pull':
diff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py
index 2f0e660..e47772c 100644
--- a/stgit/commands/rebase.py
+++ b/stgit/commands/rebase.py
@@ -56,7 +56,7 @@ def func(parser, options, args):
     if git_id(args[0]) == None:
         raise GitException, 'Unknown revision: %s' % git_id
         
-    applied = prepare_rebase(real_rebase=True, force=options.force)
+    applied = prepare_rebase(force=options.force)
     rebase(args[0])
     post_rebase(applied, options.nopush, options.merged)
 
diff --git a/stgit/git.py b/stgit/git.py
index 02590a9..1f57481 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -1070,3 +1070,9 @@ def fetch_head():
 
     # here we are sure to have a single fetch_head
     return fetch_head
+
+def all_refs():
+    """Return a list of all refs in the current repository.
+    """
+
+    return [line.split()[1] for line in _output_lines(['git-show-ref'])]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [StGIT PATCH 4/7] Fixed thinko in error message.
  2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
                   ` (2 preceding siblings ...)
  2007-06-25 21:24 ` [StGIT PATCH 3/7] Revert part of the reverted commit that we want to keep Yann Dirson
@ 2007-06-25 21:24 ` Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 5/7] Changed sync not to use -b which has other semantics Yann Dirson
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 stgit/commands/rebase.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py
index e47772c..c68f8e7 100644
--- a/stgit/commands/rebase.py
+++ b/stgit/commands/rebase.py
@@ -54,7 +54,7 @@ def func(parser, options, args):
 
     # ensure an exception is raised before popping on non-existent target
     if git_id(args[0]) == None:
-        raise GitException, 'Unknown revision: %s' % git_id
+        raise GitException, 'Unknown revision: %s' % args[0]
         
     applied = prepare_rebase(force=options.force)
     rebase(args[0])

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [StGIT PATCH 5/7] Changed sync not to use -b which has other semantics.
  2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
                   ` (3 preceding siblings ...)
  2007-06-25 21:24 ` [StGIT PATCH 4/7] Fixed thinko in error message Yann Dirson
@ 2007-06-25 21:24 ` Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 6/7] Fix t1200 to catch intermediate errors Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 7/7] If available, use gitk --argscmd in contrib/stg-gitk Yann Dirson
  6 siblings, 0 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Using --branch here is confusing from a UI point of view, and
unnecessarily complicates implementation, making it more delicate to
get rid of the crt-series global.  We now use --ref-branch (-B)
instead.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 stgit/commands/sync.py |   13 ++++++-------
 t/t2000-sync.sh        |    8 ++++----
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/stgit/commands/sync.py b/stgit/commands/sync.py
index e769602..2ec7427 100644
--- a/stgit/commands/sync.py
+++ b/stgit/commands/sync.py
@@ -38,7 +38,7 @@ The sync operation can be reverted for individual patches with --undo."""
 options = [make_option('-a', '--all',
                        help = 'synchronise all the patches',
                        action = 'store_true'),
-           make_option('-b', '--branch',
+           make_option('-B', '--ref-branch',
                        help = 'syncronise patches with BRANCH'),
            make_option('-s', '--series',
                        help = 'syncronise patches with SERIES'),
@@ -69,9 +69,9 @@ def func(parser, options, args):
     global crt_series
 
     if options.undo:
-        if options.branch or options.series:
+        if options.ref_branch or options.series:
             raise CmdException, \
-                  '--undo cannot be specified with --branch or --series'
+                  '--undo cannot be specified with --ref-branch or --series'
         __check_all()
 
         out.start('Undoing the sync of "%s"' % crt_series.get_current())
@@ -80,12 +80,11 @@ def func(parser, options, args):
         out.done()
         return
 
-    if options.branch:
+    if options.ref_branch:
         # the main function already made crt_series to be the remote
         # branch
-        remote_series = crt_series
-        stgit.commands.common.crt_series = crt_series = stack.Series()
-        if options.branch == crt_series.get_name():
+        remote_series = stack.Series(options.ref_branch)
+        if options.ref_branch == crt_series.get_name():
             raise CmdException, 'Cannot synchronise with the current branch'
         remote_patches = remote_series.get_applied()
 
diff --git a/t/t2000-sync.sh b/t/t2000-sync.sh
index 69ab1ac..f831df7 100755
--- a/t/t2000-sync.sh
+++ b/t/t2000-sync.sh
@@ -48,7 +48,7 @@ test_expect_success \
 test_expect_success \
     'Synchronise second patch with the master branch' \
     '
-    stg sync -b master p2 &&
+    stg sync -B master p2 &&
     [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
     [ "$(echo $(stg unapplied))" = "" ] &&
     test $(cat foo2.txt) = "foo2"
@@ -57,7 +57,7 @@ test_expect_success \
 test_expect_success \
     'Synchronise the first two patches with the master branch' \
     '
-    stg sync -b master -a &&
+    stg sync -B master -a &&
     [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
     [ "$(echo $(stg unapplied))" = "" ] &&
     test $(cat foo1.txt) = "foo1" &&
@@ -100,7 +100,7 @@ test_expect_success \
 test_expect_success \
     'Synchronise second patch with the master branch' \
     '
-    stg sync -b master p2 &&
+    stg sync -B master p2 &&
     [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
     [ "$(echo $(stg unapplied))" = "" ] &&
     test $(cat bar2.txt) = "bar2"
@@ -109,7 +109,7 @@ test_expect_success \
 test_expect_failure \
     'Synchronise the first two patches with the master branch (to fail)' \
     '
-    stg sync -b master -a
+    stg sync -B master -a
     '
 
 test_expect_success \

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [StGIT PATCH 6/7] Fix t1200 to catch intermediate errors.
  2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
                   ` (4 preceding siblings ...)
  2007-06-25 21:24 ` [StGIT PATCH 5/7] Changed sync not to use -b which has other semantics Yann Dirson
@ 2007-06-25 21:24 ` Yann Dirson
  2007-06-25 21:24 ` [StGIT PATCH 7/7] If available, use gitk --argscmd in contrib/stg-gitk Yann Dirson
  6 siblings, 0 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

All command sequences in tests should be linked with && or
similar, to guard against potentially missing a regresssion.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 t/t1200-push-modified.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
index 6769667..324b3b0 100755
--- a/t/t1200-push-modified.sh
+++ b/t/t1200-push-modified.sh
@@ -21,9 +21,9 @@ test_create_repo foo
 test_expect_success \
     'Clone tree and setup changes' \
     "stg clone foo bar &&
-     (cd bar && stg new p1 -m p1
+     (cd bar && stg new p1 -m p1 &&
       printf 'a\nc\n' > file && stg add file && stg refresh &&
-      stg new p2 -m p2
+      stg new p2 -m p2 &&
       printf 'a\nb\nc\n' > file && stg refresh
      )
 "

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [StGIT PATCH 7/7] If available, use gitk --argscmd in contrib/stg-gitk.
  2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
                   ` (5 preceding siblings ...)
  2007-06-25 21:24 ` [StGIT PATCH 6/7] Fix t1200 to catch intermediate errors Yann Dirson
@ 2007-06-25 21:24 ` Yann Dirson
  6 siblings, 0 replies; 8+ messages in thread
From: Yann Dirson @ 2007-06-25 21:24 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

This allows to ask gitk to recompute the list of patches to show at
every refresh.  Before this, we had problems with 'stg-gitk --all':

 - deleting a patch that was existing at startup time would trigger an
 "unknown ref" error from gitk and force to quit/restart manually;
 - patches created since startup were only visible when applied, or
 when below one of the startup patches.

Note that --argscmd is not in official gitk yet, so we don't try to
use it if it's not available.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 contrib/stg-gitk |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/contrib/stg-gitk b/contrib/stg-gitk
index dd01ef0..6ddcfb1 100755
--- a/contrib/stg-gitk
+++ b/contrib/stg-gitk
@@ -7,7 +7,6 @@ set -e
 # patch logs.
 
 # LIMITATIONS:
-# - asking gitk to "update" won't detect any new ref
 # - no support for spaces in branch names
 
 # Copyright (c) 2007 Yann Dirson <ydirson@altern.org>
@@ -20,11 +19,16 @@ usage()
 }
 
 allbranches=0
-case "$1" in
---all) allbranches=1; shift ;;
---*) usage ;;
-*) break ;;
-esac
+refsonly=0
+while [ "$#" -gt 0 ]; do
+    case "$1" in
+	--refs) refsonly=1 ;;
+	--all) allbranches=1 ;;
+	--*) usage ;;
+	*) break ;;
+    esac
+    shift
+done
 
 if [ $allbranches = 1 ] && [ "$#" -gt 0 ]; then
     usage
@@ -58,4 +62,22 @@ else
     done
 fi
 
-gitk $(find $refdirs -type f -not -name '*.log' | cut -c${GIT_DIR_SPKIPLEN}- )
+printrefs()
+{
+    find $refdirs -type f -not -name '*.log' | cut -c${GIT_DIR_SPKIPLEN}-
+}
+
+if [ $refsonly = 1 ]; then
+    printrefs
+elif grep -q -- --argscmd $(which gitk); then
+    # This gitk supports --argscmd.
+    # Let's use a hack to pass --all, which was consumed during command-line parsing
+    if [ $allbranches = 1 ]; then
+	gitk --argscmd="$0 --refs --all"
+    else
+	gitk --argscmd="$0 --refs $*"
+    fi
+else
+    # This gitk does not support --argscmd, just compute refs onces
+    gitk $(printrefs)
+fi

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-06-25 21:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-25 21:24 [StGIT PATCH 0/7] My patchqueue for 0.13 Yann Dirson
2007-06-25 21:24 ` [StGIT PATCH 1/7] Fix contrib/stg-whatchanged way of identifying a conflict Yann Dirson
2007-06-25 21:24 ` [StGIT PATCH 2/7] stg-cvs: update doc, and use correct setting for parent branch Yann Dirson
2007-06-25 21:24 ` [StGIT PATCH 3/7] Revert part of the reverted commit that we want to keep Yann Dirson
2007-06-25 21:24 ` [StGIT PATCH 4/7] Fixed thinko in error message Yann Dirson
2007-06-25 21:24 ` [StGIT PATCH 5/7] Changed sync not to use -b which has other semantics Yann Dirson
2007-06-25 21:24 ` [StGIT PATCH 6/7] Fix t1200 to catch intermediate errors Yann Dirson
2007-06-25 21:24 ` [StGIT PATCH 7/7] If available, use gitk --argscmd in contrib/stg-gitk Yann Dirson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox