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.
--- a/CHANGELOG Fri Apr 06 17:54:58 2018 +0200
+++ b/CHANGELOG Thu Mar 29 13:01:05 2018 -0700
@@ -6,6 +6,7 @@
* drop support for Mercurial 4.1
* `--obsolete` and `--old-obsolete` flags for `hg graft` are dropped
+ * `hg evolve` now return 0 if there is nothing to evolve
* fixed some memory leak issue
--- a/hgext3rd/evolve/evolvecmd.py Fri Apr 06 17:54:58 2018 +0200
+++ b/hgext3rd/evolve/evolvecmd.py Thu Mar 29 13:01:05 2018 -0700
@@ -749,6 +749,7 @@
unselectedcategories = [c for c in troublecategories if c != targetcat]
msg = None
hint = None
+ retoverride = None
troubled = {
"orphan": repo.revs("orphan()"),
@@ -835,14 +836,20 @@
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)]
--- a/tests/test-stabilize-order.t Fri Apr 06 17:54:58 2018 +0200
+++ b/tests/test-stabilize-order.t Thu Mar 29 13:01:05 2018 -0700
@@ -129,7 +129,6 @@
$ hg evolve -v
no troubled changesets
- [1]
Test behavior with --any