phases: prevent mq to qimport immutable change.
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 21 Dec 2011 23:47:18 +0100
changeset 15704 8857e150bec0
parent 15703 2a48422e27f6
child 15705 e34f4d1f0dbb
phases: prevent mq to qimport immutable change.
hgext/mq.py
tests/test-mq-qimport-fail-cleanup.t
--- a/hgext/mq.py	Mon Dec 19 23:31:38 2011 +0100
+++ b/hgext/mq.py	Wed Dec 21 23:47:18 2011 +0100
@@ -1765,6 +1765,9 @@
 
             diffopts = self.diffopts({'git': git})
             for r in rev:
+                if not repo[r].mutable():
+                    raise util.Abort(_('revision %d is not mutable') % r,
+                                     hint=_('see "hg help phases" for details'))
                 p1, p2 = repo.changelog.parentrevs(r)
                 n = repo.changelog.node(r)
                 if p2 != nullrev:
--- a/tests/test-mq-qimport-fail-cleanup.t	Mon Dec 19 23:31:38 2011 +0100
+++ b/tests/test-mq-qimport-fail-cleanup.t	Wed Dec 21 23:47:18 2011 +0100
@@ -32,3 +32,9 @@
 
   $ hg qseries
   b.patch
+
+  $ hg pull -q -r 0 . # update phase
+  $ hg qimport -r 0
+  abort: revision 0 is not mutable
+  (see "hg help phases" for details)
+  [255]