[PATCH] phases: return zero for no-op operations (issue4751)

Jordi GutiƩrrez Hermoso jordigh at octave.org
Mon Sep 14 18:26:26 CDT 2015


# HG changeset patch
# User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
# Date 1442273134 14400
#      Mon Sep 14 19:25:34 2015 -0400
# Node ID a247eb167de1ee9f447b7e0bbab0fc98babe3d7a
# Parent  6c962145f523e6e0ed1c94eb6764bf198a92917b
phases: return zero for no-op operations (issue4751)

It is rather unhelpful to return 1 if there were no changes because
the request matches the current state of phases. So we just undo that.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5032,8 +5032,7 @@ def phase(ui, repo, *revs, **opts):
 
         public < draft < secret
 
-    Returns 0 on success, 1 if no phases were changed or some could not
-    be changed.
+    Returns 0 on success, 1 if some phases could not be changed.
 
     (For more information about the phases concept, see :hg:`help phases`.)
     """
@@ -5102,7 +5101,6 @@ def phase(ui, repo, *revs, **opts):
                 ui.note(msg)
         else:
             ui.warn(_('no phases changed\n'))
-            ret = 1
     return ret
 
 def postincoming(ui, repo, modheads, optupdate, checkout):
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -322,7 +322,6 @@ check that local configs for the cached 
   ...     runcommand(server, ['phase', '-r', '.'])
   *** runcommand phase -r . -p
   no phases changed
-   [1]
   *** runcommand commit -Am.
   *** runcommand rollback
   repository tip rolled back to revision 3 (undo commit)


More information about the Mercurial-devel mailing list