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

login
register
mail settings
Submitter Augie Fackler
Date Sept. 11, 2014, 2:07 p.m.
Message ID <4d25031b51823ac92aae.1410444437@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/5797/
State Accepted
Headers show

Comments

Augie Fackler - Sept. 11, 2014, 2:07 p.m.
# HG changeset patch
# User Augie Fackler <raf@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.
Pierre-Yves David - Sept. 11, 2014, 2:53 p.m.
On 09/11/2014 04:07 PM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@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

good clean up. pushed to the clowncopter.

Patch

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'))