rebase: make dry-run return 1 or 0 according to result
authorSushil khanchi <sushilkhanchi97@gmail.com>
Sat, 23 Jun 2018 08:59:18 +0530
changeset 38443 e6b643ccf87d
parent 38442 36edfbac7281
child 38444 a0c3d83d5f04
rebase: make dry-run return 1 or 0 according to result In dry-run mode, if there is no conflict return 0, if any then return 1 Differential Revision: https://phab.mercurial-scm.org/D3829
hgext/rebase.py
tests/test-rebase-inmemory.t
--- a/hgext/rebase.py	Fri Mar 24 00:33:35 2017 -0400
+++ b/hgext/rebase.py	Sat Jun 23 08:59:18 2018 +0530
@@ -825,8 +825,10 @@
                             **opts)
         except error.InMemoryMergeConflictsError:
             ui.status(_('hit a merge conflict\n'))
+            return 1
         else:
             ui.status(_('there will be no conflict, you can rebase\n'))
+            return 0
         finally:
             _origrebase(ui, repo, abort=True)
     elif inmemory:
--- a/tests/test-rebase-inmemory.t	Fri Mar 24 00:33:35 2017 -0400
+++ b/tests/test-rebase-inmemory.t	Sat Jun 23 08:59:18 2018 +0530
@@ -287,6 +287,7 @@
   rollback completed
   hit a merge conflict
   rebase aborted
+  [1]
   $ hg diff
   $ hg status
   $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
@@ -322,3 +323,4 @@
   merging e
   hit a merge conflict
   rebase aborted
+  [1]