mq: use "mq.applied[i].name" instead of "mq.appliedname(i)" for safety
Before this patch, "hg qselect --reapply" is aborted when "--verbose"
is specified, because "mq.appliedname()" returns "INDEX PATCHNAME"
instead of "PATCHNAME" in such case and "mq.push" can't accept the
former as the name of patch.
This patch uses "mq.applied[i].name" instead of "mq.appliedname(i)" as
the name of the patch to be pushed for safety.
Now, there is no code path using "mq.appliedname()", and it should be
removed to prevent developers from using it in the wrong way like this
issue.
--- a/hgext/mq.py Fri Sep 12 02:29:19 2014 +0900
+++ b/hgext/mq.py Fri Sep 12 02:29:19 2014 +0900
@@ -3015,7 +3015,7 @@
ui.write(g, '\n')
else:
ui.write(_('no active guards\n'))
- reapply = opts.get('reapply') and q.applied and q.appliedname(-1)
+ reapply = opts.get('reapply') and q.applied and q.applied[-1].name
popped = False
if opts.get('pop') or opts.get('reapply'):
for i in xrange(len(q.applied)):
--- a/tests/test-mq-guards.t Fri Sep 12 02:29:19 2014 +0900
+++ b/tests/test-mq-guards.t Fri Sep 12 02:29:19 2014 +0900
@@ -256,14 +256,21 @@
$ hg qpush -a
applying c.patch
now at: c.patch
- $ hg qselect -n --reapply
+ $ hg qselect -n --reapply -v
guards deactivated
popping guarded patches
popping c.patch
popping b.patch
patch queue now empty
reapplying unguarded patches
+ skipping a.patch - guarded by '+1' '+2'
+ skipping b.patch - guarded by '+2'
+ skipping a.patch - guarded by '+1' '+2'
+ skipping b.patch - guarded by '+2'
applying c.patch
+ patching file c
+ adding c
+ c
now at: c.patch
guards in series file: +1 +2 -3