[PATCH 1 of 2] context: rename property from mutable to immutable

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Fri Feb 3 10:36:08 UTC 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1327941072 -3600
# Node ID 77bd9605c6da0d58b8f48fe8e5b56c24e34d3146
# Parent  0620421044a2bcaafd054a6ee454614888699de8
context: rename property from mutable to immutable

Callers have been updated.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1817,12 +1817,12 @@ class queue(object):
                                      % rev[0])
                 lastparent = None
 
             diffopts = self.diffopts({'git': git})
             for r in rev:
-                if not repo[r].mutable():
-                    raise util.Abort(_('revision %d is not mutable') % r,
+                if repo[r].immutable():
+                    raise util.Abort(_('revision %d is immutable') % r,
                                      hint=_('see "hg help phases" for details'))
                 p1, p2 = repo.changelog.parentrevs(r)
                 n = repo.changelog.node(r)
                 if p2 != nullrev:
                     raise util.Abort(_('cannot import merge revision %d') % r)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -207,11 +207,11 @@ def rebase(ui, repo, **opts):
                                               rebaseset, rebaseset)):
                 raise util.Abort(
                     _("can't remove original changesets with"
                       " unrebased descendants"),
                     hint=_('use --keep to keep original changesets'))
-            elif not keepf and not repo[root].mutable():
+            elif not keepf and repo[root].immutable():
                 raise util.Abort(_("can't rebase immutable changeset %s")
                                  % repo[root],
                                  hint=_('see hg help phases for details'))
             else:
                 result = buildstate(repo, dest, rebaseset, detachf)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -124,12 +124,12 @@ class changectx(object):
             # outdated cache
             del self._repo._phaserev
         return self._repo._phaserev[self._rev]
     def phasestr(self):
         return phases.phasenames[self.phase()]
-    def mutable(self):
-        return self._repo._phaserev[self._rev] > phases.public
+    def immutable(self):
+        return self._repo._phaserev[self._rev] <= phases.public
     def hidden(self):
         return self._rev in self._repo.changelog.hiddenrevs
 
     def parents(self):
         """return contexts for each parent changeset"""
diff --git a/tests/test-mq-qimport-fail-cleanup.t b/tests/test-mq-qimport-fail-cleanup.t
--- a/tests/test-mq-qimport-fail-cleanup.t
+++ b/tests/test-mq-qimport-fail-cleanup.t
@@ -34,8 +34,8 @@ valid patches before fail added to serie
   b.patch
 
   $ hg pull -q -r 0 . # update phase
   [1]
   $ hg qimport -r 0
-  abort: revision 0 is not mutable
+  abort: revision 0 is immutable
   (see "hg help phases" for details)
   [255]



More information about the Mercurial-devel mailing list