[PATCH 2 of 2 STABLE] mq: do not call [0] on revset

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Nov 1 18:24:37 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1414882777 0
#      Sat Nov 01 22:59:37 2014 +0000
# Branch stable
# Node ID 2ad893298ac110ef52af5823dfb567af8a8d9eef
# Parent  03d8d72e9155209332e969a64b1ee0b3153478a3
mq: do not call [0] on revset

The __getitem__ method have been removed. The "first" method is to be used
instead. Test have been extended to test this code path.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1999,11 +1999,11 @@ class queue(object):
                                    'branch') % rev.last())
             if self.applied:
                 base = repo.changelog.node(rev.first())
                 if base in [n.node for n in self.applied]:
                     raise util.Abort(_('revision %d is already managed')
-                                     % rev[0])
+                                     % rev.first())
                 if heads != [self.applied[-1].node]:
                     raise util.Abort(_('revision %d is not the parent of '
                                        'the queue') % rev.first())
                 base = repo.changelog.rev(self.applied[0].node)
                 lastparent = repo.changelog.parentrevs(base)[0]
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1594,6 +1594,13 @@ Test interraction with revset (issue4426
   $ hg ci -m a
   $ echo a >> a
   $ hg ci -m a
   $ hg qimport -r 0::
 
+reimport things
+
+  $ hg qimport -r 1::
+  abort: revision 2 is already managed
+  [255]
+
+
   $ cd ..


More information about the Mercurial-devel mailing list