Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 21200:a1381eea7c7d stable
graft: do not use `.remove` on a smart set (regression)
Revset calls use to return a list. Graft use to mutate that list. We cannot do
this anymore leading to a crash when grafting multiple changeset with a revset.
File ".../mercurial/commands.py", line 3117, in graft
revs.remove(rev)
AttributeError: '_addset' object has no attribute 'remove'
We are late in code-freeze so we make the shortest possible fix by turning it
back to a list.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 28 Apr 2014 17:25:36 -0700 |
parents | 7991df9d2f20 |
children | 0054a77f49df 17da326fd041 |
comparison
equal
deleted
inserted
replaced
21199:e9c2f76be74b | 21200:a1381eea7c7d |
---|---|
3108 return -1 | 3108 return -1 |
3109 | 3109 |
3110 # check for ancestors of dest branch | 3110 # check for ancestors of dest branch |
3111 crev = repo['.'].rev() | 3111 crev = repo['.'].rev() |
3112 ancestors = repo.changelog.ancestors([crev], inclusive=True) | 3112 ancestors = repo.changelog.ancestors([crev], inclusive=True) |
3113 # Cannot use x.remove(y) on smart set, this has to be a list. | |
3114 # XXX make this lazy in the future | |
3115 revs = list(revs) | |
3113 # don't mutate while iterating, create a copy | 3116 # don't mutate while iterating, create a copy |
3114 for rev in list(revs): | 3117 for rev in list(revs): |
3115 if rev in ancestors: | 3118 if rev in ancestors: |
3116 ui.warn(_('skipping ancestor revision %s\n') % rev) | 3119 ui.warn(_('skipping ancestor revision %s\n') % rev) |
3120 # XXX remove on list is slow | |
3117 revs.remove(rev) | 3121 revs.remove(rev) |
3118 if not revs: | 3122 if not revs: |
3119 return -1 | 3123 return -1 |
3120 | 3124 |
3121 # analyze revs for earlier grafts | 3125 # analyze revs for earlier grafts |