Patchwork D3857: rebase: suppress warning thrown when aborting rebase in case of dryrun

login
register
mail settings
Submitter phabricator
Date June 28, 2018, 8:10 p.m.
Message ID <differential-rev-PHID-DREV-xtbhsiw5vhjihf3tp2ce-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32493/
State Superseded
Headers show

Comments

phabricator - June 28, 2018, 8:10 p.m.
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch dryrun output contained "rebase aborted" every
  time we run rebase in dryrun mode and this warning does not sound
  safe from a user prespective.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS




To: khanchi97, #hg-reviewers
Cc: 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
@@ -212,7 +212,6 @@ 
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
   $ hg diff
   $ hg status
@@ -245,7 +244,6 @@ 
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -285,7 +283,6 @@ 
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   [1]
   $ hg diff
   $ hg status
@@ -321,5 +318,4 @@ 
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
   [1]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@ 
         skippedset.update(obsoleteextinctsuccessors)
         _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-    def _prepareabortorcontinue(self, isabort, backup=True):
+    def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
         try:
             self.restorestatus()
             self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -342,7 +342,8 @@ 
                 raise error.Abort(msg, hint=hint)
         if isabort:
             return abort(self.repo, self.originalwd, self.destmap, self.state,
-                         activebookmark=self.activebookmark, backup=backup)
+                         activebookmark=self.activebookmark, backup=backup,
+                         suppwarns=suppwarns)
 
     def _preparenewrebase(self, destmap):
         if not destmap:
@@ -830,7 +831,8 @@ 
                 return 0
             finally:
                 # no need to store back in case of dry-run
-                rbsrt._prepareabortorcontinue(isabort=True, backup=False)
+                rbsrt._prepareabortorcontinue(isabort=True, backup=False,
+                                              suppwarns=True)
     elif inmemory:
         try:
             # in-memory merge doesn't support conflicts, so if we hit any, abort
@@ -1553,7 +1555,8 @@ 
 
     return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True,
+          suppwarns=False):
     '''Restore the repository to its original state.  Additional args:
 
     activebookmark: the name of the bookmark that should be active after the
@@ -1606,7 +1609,8 @@ 
     finally:
         clearstatus(repo)
         clearcollapsemsg(repo)
-        repo.ui.warn(_('rebase aborted\n'))
+        if not suppwarns:
+            repo.ui.warn(_('rebase aborted\n'))
     return 0
 
 def sortsource(destmap):