Patchwork evolve: do not exit 1 when there are no troubled changesets (issue5823)

login
register
mail settings
Submitter via Mercurial-devel
Date March 29, 2018, 8:39 p.m.
Message ID <1607ec1973108d156e41.1522355976@dragonair.svl.corp.google.com>
Download mbox | patch
Permalink /patch/29942/
State Accepted
Headers show

Comments

via Mercurial-devel - March 29, 2018, 8:39 p.m.
# HG changeset patch
# User Kyle Lippincott <spectral@google.com>
# Date 1522353665 25200
#      Thu Mar 29 13:01:05 2018 -0700
# Node ID 1607ec1973108d156e41aa75db6fc571fa99c0ac
# Parent  9ad461df4d4d1696fe15086f6afea9cebb24a617
evolve: do not exit 1 when there are no troubled changesets (issue5823)

There are possibly other cases we also do not wish to exit non-zero for in this
function, but I did not analyze them closely and am just looking at resolving
issue5823.

Patch

diff --git a/hgext3rd/evolve/evolvecmd.py b/hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py
+++ b/hgext3rd/evolve/evolvecmd.py
@@ -718,6 +718,7 @@  def _handlenotrouble(ui, repo, allopt, r
     unselectedcategories = [c for c in troublecategories if c != targetcat]
     msg = None
     hint = None
+    retoverride = None
 
     troubled = {
         "orphan": repo.revs("orphan()"),
@@ -804,14 +805,20 @@  def _handlenotrouble(ui, repo, allopt, r
                     hint = hintmap['any+' + ('+'.join(othertroubles))]
                 else:
                     msg = _("no troubled changesets")
+                    # Exit with a 0 (success) status in this case.
+                    retoverride = 0
 
     assert msg is not None
     ui.write_err("%s\n" % msg)
     if hint:
         ui.write_err("(%s)\n" % hint)
-        return 2
+        ret = 2
     else:
-        return 1
+        ret = 1
+
+    if retoverride is not None:
+        return retoverride
+    return ret
 
 def _preparelistctxs(items, condition):
     return [item.hex() for item in items if condition(item)]
diff --git a/tests/test-stabilize-order.t b/tests/test-stabilize-order.t
--- a/tests/test-stabilize-order.t
+++ b/tests/test-stabilize-order.t
@@ -129,7 +129,6 @@  Test stabilizing a descendant predecesso
   
   $ hg evolve -v
   no troubled changesets
-  [1]
 
 Test behavior with --any