Patchwork D9659: rebase: handle the case when nothing to rebase (dry-run)

login
register
mail settings
Submitter phabricator
Date Dec. 26, 2020, 1:01 p.m.
Message ID <differential-rev-PHID-DREV-emkexivrflz6swykmk64-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47970/
State Superseded
Headers show

Comments

phabricator - Dec. 26, 2020, 1:01 p.m.
khanchi97 created this revision.
Herald added a reviewer: martinvonz.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In dry-run mode, even when there was no rebase in progress it tried
  to abort (for context, at the end of dry-run mode we abort the in-memory
  performed rebase) because we were not early checking if there was any rebase
  started.
  
  Changes in test file reflect the fixed behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




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

Patch

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -342,9 +342,7 @@ 
   $ hg reb -r . -d '.^' -n
   starting dry-run rebase; repository will not be changed
   nothing to rebase
-  dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
-  abort: no rebase in progress
-  [20]
+  [1]
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1139,13 +1139,16 @@ 
         try:
             overrides = {(b'rebase', b'singletransaction'): True}
             with ui.configoverride(overrides, b'rebase'):
-                _origrebase(
+                res = _origrebase(
                     ui,
                     repo,
                     action,
                     opts,
                     rbsrt,
                 )
+                if res == _nothingtorebase():
+                    needsabort = False
+                    return res
         except error.ConflictResolutionRequired:
             ui.status(_(b'hit a merge conflict\n'))
             return 1