##// END OF EJS Templates
rebase: filter out descendants of divergence-causing commits earlier...
Martin von Zweigbergk -
r47590:535de0e3 default
parent child Browse files
Show More
@@ -361,6 +361,19 b' class rebaseruntime(object):'
361 skippedset = set(self.obsolete_with_successor_in_destination)
361 skippedset = set(self.obsolete_with_successor_in_destination)
362 skippedset.update(self.obsolete_with_successor_in_rebase_set)
362 skippedset.update(self.obsolete_with_successor_in_rebase_set)
363 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
363 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
364 allowdivergence = self.ui.configbool(
365 b'experimental', b'evolution.allowdivergence'
366 )
367 if allowdivergence:
368 self.obsolete_with_successor_in_rebase_set = set()
369 else:
370 for rev in self.repo.revs(
371 b'descendants(%ld) and not %ld',
372 self.obsolete_with_successor_in_rebase_set,
373 self.obsolete_with_successor_in_rebase_set,
374 ):
375 self.state.pop(rev, None)
376 self.destmap.pop(rev, None)
364
377
365 def _prepareabortorcontinue(
378 def _prepareabortorcontinue(
366 self, isabort, backup=True, suppwarns=False, dryrun=False, confirm=False
379 self, isabort, backup=True, suppwarns=False, dryrun=False, confirm=False
@@ -493,19 +506,10 b' class rebaseruntime(object):'
493 def progress(ctx):
506 def progress(ctx):
494 p.increment(item=(b"%d:%s" % (ctx.rev(), ctx)))
507 p.increment(item=(b"%d:%s" % (ctx.rev(), ctx)))
495
508
496 allowdivergence = self.ui.configbool(
497 b'experimental', b'evolution.allowdivergence'
498 )
499 for subset in sortsource(self.destmap):
509 for subset in sortsource(self.destmap):
500 sortedrevs = self.repo.revs(b'sort(%ld, -topo)', subset)
510 sortedrevs = self.repo.revs(b'sort(%ld, -topo)', subset)
501 if not allowdivergence:
502 sortedrevs -= self.repo.revs(
503 b'descendants(%ld) and not %ld',
504 self.obsolete_with_successor_in_rebase_set,
505 self.obsolete_with_successor_in_rebase_set,
506 )
507 for rev in sortedrevs:
511 for rev in sortedrevs:
508 self._rebasenode(tr, rev, allowdivergence, progress)
512 self._rebasenode(tr, rev, progress)
509 p.complete()
513 p.complete()
510 ui.note(_(b'rebase merging completed\n'))
514 ui.note(_(b'rebase merging completed\n'))
511
515
@@ -567,16 +571,13 b' class rebaseruntime(object):'
567
571
568 return newnode
572 return newnode
569
573
570 def _rebasenode(self, tr, rev, allowdivergence, progressfn):
574 def _rebasenode(self, tr, rev, progressfn):
571 repo, ui, opts = self.repo, self.ui, self.opts
575 repo, ui, opts = self.repo, self.ui, self.opts
572 ctx = repo[rev]
576 ctx = repo[rev]
573 desc = _ctxdesc(ctx)
577 desc = _ctxdesc(ctx)
574 if self.state[rev] == rev:
578 if self.state[rev] == rev:
575 ui.status(_(b'already rebased %s\n') % desc)
579 ui.status(_(b'already rebased %s\n') % desc)
576 elif (
580 elif rev in self.obsolete_with_successor_in_rebase_set:
577 not allowdivergence
578 and rev in self.obsolete_with_successor_in_rebase_set
579 ):
580 msg = (
581 msg = (
581 _(
582 _(
582 b'note: not rebasing %s and its descendants as '
583 b'note: not rebasing %s and its descendants as '
@@ -72,9 +72,9 b' consequence f (descendant of d) is left '
72 $ hg rebase -b 'e' -d 'x'
72 $ hg rebase -b 'e' -d 'x'
73 rebasing 1:488e1b7e7341 b "b"
73 rebasing 1:488e1b7e7341 b "b"
74 rebasing 3:a82ac2b38757 c "c"
74 rebasing 3:a82ac2b38757 c "c"
75 note: not rebasing 4:76be324c128b d "d" and its descendants as this would cause divergence
75 rebasing 5:027ad6c5830d d' "d'"
76 rebasing 5:027ad6c5830d d' "d'"
76 rebasing 6:d60ebfa0f1cb e "e"
77 rebasing 6:d60ebfa0f1cb e "e"
77 note: not rebasing 4:76be324c128b d "d" and its descendants as this would cause divergence
78 $ hg log -G -r 'a'::
78 $ hg log -G -r 'a'::
79 o 11:eb6d63fc4ed5 e
79 o 11:eb6d63fc4ed5 e
80 |
80 |
@@ -207,16 +207,16 b' Similar test on a more complex graph'
207 $ hg rebase -b 'f' -d 'x'
207 $ hg rebase -b 'f' -d 'x'
208 rebasing 1:488e1b7e7341 b "b"
208 rebasing 1:488e1b7e7341 b "b"
209 rebasing 3:a82ac2b38757 c "c"
209 rebasing 3:a82ac2b38757 c "c"
210 rebasing 5:63324dc512ea e' "e'"
211 rebasing 7:3ffec603ab53 f "f"
212 rebasing 4:76be324c128b d "d"
210 rebasing 4:76be324c128b d "d"
213 note: not rebasing 6:e36fae928aec e "e" and its descendants as this would cause divergence
211 note: not rebasing 6:e36fae928aec e "e" and its descendants as this would cause divergence
212 rebasing 5:63324dc512ea e' "e'"
213 rebasing 7:3ffec603ab53 f "f"
214 $ hg log -G -r 'a':
214 $ hg log -G -r 'a':
215 o 13:a1707a5b7c2c d
215 o 13:ef6251596616 f
216 |
216 |
217 | o 12:ef6251596616 f
217 o 12:b6f172e64af9 e'
218 | |
218 |
219 | o 11:b6f172e64af9 e'
219 | o 11:a1707a5b7c2c d
220 |/
220 |/
221 o 10:d008e6b4d3fd c
221 o 10:d008e6b4d3fd c
222 |
222 |
@@ -224,13 +224,13 b' Similar test on a more complex graph'
224 |
224 |
225 | * 8:2876ce66c6eb g
225 | * 8:2876ce66c6eb g
226 | |
226 | |
227 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
227 | | x 7:3ffec603ab53 f (rewritten using rebase as 13:ef6251596616)
228 | | |
228 | | |
229 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
229 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
230 | | |
230 | | |
231 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
231 | | x 5:63324dc512ea e' (rewritten using rebase as 12:b6f172e64af9)
232 | | |
232 | | |
233 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
233 | x | 4:76be324c128b d (rewritten using rebase as 11:a1707a5b7c2c)
234 | |/
234 | |/
235 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
235 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
236 | |
236 | |
General Comments 0
You need to be logged in to leave comments. Login now