Git development
 help / color / mirror / Atom feed
From: Yann Dirson <ydirson@altern.org>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGIT PATCH 6/9] Changed sync not to use -b which has other semantics.
Date: Sun, 17 Jun 2007 00:01:00 +0200	[thread overview]
Message-ID: <20070616220100.14941.3131.stgit@gandelf.nowhere.earth> (raw)
In-Reply-To: <20070616213615.14941.31187.stgit@gandelf.nowhere.earth>

Using --branch here is confusing from a UI point of view, and
unnecessarily complicates implementation, making in 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 |   15 ++++++---------
 t/t2000-sync.sh        |    8 ++++----
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/stgit/commands/sync.py b/stgit/commands/sync.py
index 9c95b99..2882391 100644
--- a/stgit/commands/sync.py
+++ b/stgit/commands/sync.py
@@ -51,7 +51,7 @@ class concreteCommand(Command):
     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'),
@@ -70,9 +70,9 @@ class concreteCommand(Command):
         global crt_series
 
         if self.flags.undo:
-            if self.flags.branch or self.flags.series:
+            if self.flags.ref_branch or self.flags.series:
                 raise CmdException, \
-                      '--undo cannot be specified with --branch or --series'
+                      '--undo cannot be specified with --ref-branch or --series'
             self.__check_all()
 
             out.start('Undoing the sync of "%s"' % crt_series.get_current())
@@ -81,12 +81,9 @@ class concreteCommand(Command):
             out.done()
             return
 
-        if self.flags.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 self.flags.branch == crt_series.get_name():
+        if self.flags.ref_branch:
+            remote_series = stack.Series(self.flags.ref_branch)
+            if self.flags.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 \

  parent reply	other threads:[~2007-06-16 22:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-16 22:00 [StGIT PATCH 0/9] Refactoring of command handling Yann Dirson
2007-06-16 22:00 ` [StGIT PATCH 1/9] Fix contrib/stg-whatchanged way of identifying a conflict Yann Dirson
2007-06-16 22:00 ` [StGIT PATCH 2/9] Revert part of the reverted commit that we want to keep Yann Dirson
2007-06-16 22:00 ` [StGIT PATCH 4/9] Fixed thinko in error message Yann Dirson
2007-06-16 22:00 ` [StGIT PATCH 5/9] Promote more common functions to Command methods Yann Dirson
2007-06-16 22:01 ` Yann Dirson [this message]
2007-06-16 22:01 ` [StGIT PATCH 7/9] Replace crt_series uses with a method call Yann Dirson
2007-06-16 22:01 ` [StGIT PATCH 8/9] Add a constructor to PatchSet Yann Dirson
2007-06-16 22:01 ` [StGIT PATCH 9/9] Cleanup the use of the Series class Yann Dirson
2007-06-19 22:41 ` [StGIT PATCH 0/9] Refactoring of command handling Yann Dirson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070616220100.14941.3131.stgit@gandelf.nowhere.earth \
    --to=ydirson@altern.org \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox