chiark / gitweb /
Remove --undo flags from stg commands and docs
[stgit] / stgit / commands / sync.py
index 0e2c18fbf5c320032f31b8e9c92acc01ecf5f869..966ac553635fece01886db34f230da86437717a5 100644 (file)
@@ -16,37 +16,32 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
 import sys, os
 """
 
 import sys, os
-from optparse import OptionParser, make_option
-
 import stgit.commands.common
 import stgit.commands.common
+from stgit.argparse import opt
 from stgit.commands.common import *
 from stgit.utils import *
 from stgit.out import *
 from stgit import stack, git
 
 from stgit.commands.common import *
 from stgit.utils import *
 from stgit.out import *
 from stgit import stack, git
 
-
-help = 'synchronise patches with a branch or a series'
-usage = """%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]
-
+help = 'Synchronise patches with a branch or a series'
+kind = 'patch'
+usage = ['[options] [<patch1>] [<patch2>] [<patch3>..<patch4>]']
+description = """
 For each of the specified patches perform a three-way merge with the
 same patch in the specified branch or series. The command can be used
 for keeping patches on several branches in sync. Note that the
 operation may fail for some patches because of conflicts. The patches
 For each of the specified patches perform a three-way merge with the
 same patch in the specified branch or series. The command can be used
 for keeping patches on several branches in sync. Note that the
 operation may fail for some patches because of conflicts. The patches
-in the series must apply cleanly.
-
-The sync operation can be reverted for individual patches with --undo."""
-
-directory = DirectoryGotoToplevel()
-options = [make_option('-a', '--all',
-                       help = 'synchronise all the applied patches',
-                       action = 'store_true'),
-           make_option('-B', '--ref-branch',
-                       help = 'syncronise patches with BRANCH'),
-           make_option('-s', '--series',
-                       help = 'syncronise patches with SERIES'),
-           make_option('--undo',
-                       help = 'undo the synchronisation of the current patch',
-                       action = 'store_true')]
+in the series must apply cleanly."""
+
+options = [
+    opt('-a', '--all', action = 'store_true',
+        short = 'Synchronise all the applied patches'),
+    opt('-B', '--ref-branch',
+        short = 'Syncronise patches with BRANCH'),
+    opt('-s', '--series',
+        short = 'Syncronise patches with SERIES')]
+
+directory = DirectoryGotoToplevel(log = True)
 
 def __check_all():
     check_local_changes()
 
 def __check_all():
     check_local_changes()
@@ -68,18 +63,6 @@ def __series_merge_patch(base, patchdir, pname):
 def func(parser, options, args):
     """Synchronise a range of patches
     """
 def func(parser, options, args):
     """Synchronise a range of patches
     """
-    if options.undo:
-        if options.ref_branch or options.series:
-            raise CmdException, \
-                  '--undo cannot be specified with --ref-branch or --series'
-        __check_all()
-
-        out.start('Undoing the sync of "%s"' % crt_series.get_current())
-        crt_series.undo_refresh()
-        git.reset()
-        out.done()
-        return
-
     if options.ref_branch:
         remote_series = stack.Series(options.ref_branch)
         if options.ref_branch == crt_series.get_name():
     if options.ref_branch:
         remote_series = stack.Series(options.ref_branch)
         if options.ref_branch == crt_series.get_name():
@@ -157,8 +140,7 @@ def func(parser, options, args):
         bottom = patch.get_bottom()
         top = patch.get_top()
 
         bottom = patch.get_bottom()
         top = patch.get_top()
 
-        # reset the patch backup information. That's needed in case we
-        # undo the sync but there were no changes made
+        # reset the patch backup information.
         patch.set_top(top, backup = True)
 
         # the actual merging (either from a branch or an external file)
         patch.set_top(top, backup = True)
 
         # the actual merging (either from a branch or an external file)