[PATCH 2 of 2] commit: correctly check commit mutability during commit --amend

Augie Fackler raf at durin42.com
Thu Sep 11 09:07:17 CDT 2014


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1408473211 14400
#      Tue Aug 19 14:33:31 2014 -0400
# Node ID 4d25031b51823ac92aaeaea330d45cc3bbf77204
# Parent  0d4fe8a14d5f92e2dc8349ff5191dc64017d1637
commit: correctly check commit mutability during commit --amend

The right way to check if a context is mutable is to call .mutable(),
not to compare .phase() with public.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1406,7 +1406,7 @@
             raise util.Abort(_('cannot amend with ui.commitsubrepos enabled'))
 
         old = repo['.']
-        if old.phase() == phases.public:
+        if not old.mutable():
             raise util.Abort(_('cannot amend public changesets'))
         if len(repo[None].parents()) > 1:
             raise util.Abort(_('cannot amend while merging'))


More information about the Mercurial-devel mailing list