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.
This commit is contained in:
FUJIWARA Katsunori 2014-09-12 02:29:19 +09:00
parent 5e22c34bd1
commit 3efcc894d8
2 changed files with 9 additions and 2 deletions

View File

@ -3015,7 +3015,7 @@ def select(ui, repo, *args, **opts):
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)):

View File

@ -256,14 +256,21 @@ should push b.patch
$ 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