D3969: rebase: raise error for options conflicting with --stop

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Fri Aug 10 11:15:42 UTC 2018


khanchi97 updated this revision to Diff 10287.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3969?vs=9655&id=10287

REVISION DETAIL
  https://phab.mercurial-scm.org/D3969

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -2003,3 +2003,22 @@
   o  0:cb9a9f314b8b test
      a
   
+Test --stop raise errors with conflicting options:
+=================================================
+  $ hg rebase -s 3 -d 5
+  rebasing 3:055a42cdd887 "d"
+  merging d
+  warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ hg rebase --stop --dry-run
+  abort: cannot use --stop with --dry-run or --confirm
+  [255]
+
+  $ hg rebase -s 3 -d 5
+  abort: rebase in progress
+  (use 'hg rebase --continue' or 'hg rebase --abort')
+  [255]
+  $ hg rebase --stop --continue
+  abort: cannot use --stop with --abort or --continue
+  [255]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -802,6 +802,12 @@
     inmemory = ui.configbool('rebase', 'experimental.inmemory')
     dryrun = opts.get('dry_run')
     stop = opts.get('stop')
+    if stop:
+        if opts.get('dry_run') or opts.get('confirm'):
+            raise error.Abort(_('cannot use --stop with --dry-run '
+                                'or --confirm'))
+        if opts.get('abort') or opts.get('continue'):
+            raise error.Abort(_('cannot use --stop with --abort or --continue'))
     if dryrun:
         if opts.get('abort'):
             raise error.Abort(_('cannot specify both --dry-run and --abort'))
@@ -838,7 +844,6 @@
         rbsrt = rebaseruntime(repo, ui)
         rbsrt.restorestatus()
 
-        #todo: raise error for conflicting options
         if rbsrt.collapsef:
             raise error.Abort(_("cannot stop in --collapse session"))
         allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
@@ -848,6 +853,7 @@
                 hint=_('either enable obsmarkers to allow unstable '
                        'revisions or use --keep to keep original '
                        'changesets'))
+
         with repo.wlock(), repo.lock():
             if needupdate(repo, rbsrt.state):
                 # update to the current working revision



To: khanchi97, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list