diff hgext/mq.py @ 16048:140b6282ac79 stable

mq: prevent rewriting operation on public changeset The following operation are denied if the mq changeset is public * qrefresh * qpop * qfold note: qimport was already denied.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 01 Feb 2012 12:20:10 +0100
parents 74d00b5d00cc
children db4b0532dbf2 c36db39b3fee
line wrap: on
line diff
--- a/hgext/mq.py	Tue Jan 31 23:13:04 2012 -0600
+++ b/hgext/mq.py	Wed Feb 01 12:20:10 2012 +0100
@@ -1313,6 +1313,10 @@
             if heads != [self.applied[-1].node]:
                 raise util.Abort(_("popping would remove a revision not "
                                    "managed by this patch queue"))
+            if not repo[self.applied[-1].node].mutable():
+                raise util.Abort(
+                    _("popping would remove an immutable revision"),
+                    hint=_('see "hg help phases" for details'))
 
             # we know there are no local changes, so we can make a simplified
             # form of hg.update.
@@ -1374,6 +1378,9 @@
             (top, patchfn) = (self.applied[-1].node, self.applied[-1].name)
             if repo.changelog.heads(top) != [top]:
                 raise util.Abort(_("cannot refresh a revision with children"))
+            if not repo[top].mutable():
+                raise util.Abort(_("cannot refresh immutable revision"),
+                                 hint=_('see "hg help phases" for details'))
 
             inclsubs = self.checksubstate(repo)