##// END OF EJS Templates
graft: do not use `.remove` on a smart set (regression)...
Pierre-Yves David -
r21200:a1381eea stable
parent child Browse files
Show More
@@ -3110,10 +3110,14 def graft(ui, repo, *revs, **opts):
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
@@ -571,3 +571,14 All copies of a cset
571 date: Thu Jan 01 00:00:00 1970 +0000
571 date: Thu Jan 01 00:00:00 1970 +0000
572 summary: 2
572 summary: 2
573
573
574
575 graft works on complex revset
576
577 $ hg graft 'origin(13) or destination(origin(13))'
578 skipping ancestor revision 21
579 skipping ancestor revision 22
580 skipping revision 2 (already grafted to 22)
581 grafting revision 7
582 grafting revision 13
583 grafting revision 19
584 merging b
General Comments 0
You need to be logged in to leave comments. Login now