changeset 15704:8857e150bec0

phases: prevent mq to qimport immutable change.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 21 Dec 2011 23:47:18 +0100
parents 2a48422e27f6
children e34f4d1f0dbb
files hgext/mq.py tests/test-mq-qimport-fail-cleanup.t
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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]