comparison hgext/rebase.py @ 47793:0044a7ad9f2f

rebase: use obsolete.isenabled() to check for experimental.allowdivergence Now that obsolete.isenabled() can also check if divergence is allowed, let's use it for consistency. Other experimental.evolution options are already checked via this function. Differential Revision: https://phab.mercurial-scm.org/D11221
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 28 Jul 2021 13:45:41 +0300
parents c9cedb546262
children 5ced12cfa41b
comparison
equal deleted inserted replaced
47770:460e479be66e 47793:0044a7ad9f2f
360 self.obsolete_with_successor_in_rebase_set, 360 self.obsolete_with_successor_in_rebase_set,
361 ) = _compute_obsolete_sets(self.repo, obsoleteset, self.destmap) 361 ) = _compute_obsolete_sets(self.repo, obsoleteset, self.destmap)
362 skippedset = set(self.obsolete_with_successor_in_destination) 362 skippedset = set(self.obsolete_with_successor_in_destination)
363 skippedset.update(self.obsolete_with_successor_in_rebase_set) 363 skippedset.update(self.obsolete_with_successor_in_rebase_set)
364 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset) 364 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
365 allowdivergence = self.ui.configbool( 365 if obsolete.isenabled(self.repo, obsolete.allowdivergenceopt):
366 b'experimental', b'evolution.allowdivergence'
367 )
368 if allowdivergence:
369 self.obsolete_with_successor_in_rebase_set = set() 366 self.obsolete_with_successor_in_rebase_set = set()
370 else: 367 else:
371 for rev in self.repo.revs( 368 for rev in self.repo.revs(
372 b'descendants(%ld) and not %ld', 369 b'descendants(%ld) and not %ld',
373 self.obsolete_with_successor_in_rebase_set, 370 self.obsolete_with_successor_in_rebase_set,
1650 `rebaseobsrevs`: set of obsolete revision in source 1647 `rebaseobsrevs`: set of obsolete revision in source
1651 `rebaseobsskipped`: set of revisions from source skipped because they have 1648 `rebaseobsskipped`: set of revisions from source skipped because they have
1652 successors in destination or no non-obsolete successor. 1649 successors in destination or no non-obsolete successor.
1653 """ 1650 """
1654 # Obsolete node with successors not in dest leads to divergence 1651 # Obsolete node with successors not in dest leads to divergence
1655 divergenceok = ui.configbool(b'experimental', b'evolution.allowdivergence') 1652 divergenceok = obsolete.isenabled(repo, obsolete.allowdivergenceopt)
1656 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped 1653 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
1657 1654
1658 if divergencebasecandidates and not divergenceok: 1655 if divergencebasecandidates and not divergenceok:
1659 divhashes = (bytes(repo[r]) for r in divergencebasecandidates) 1656 divhashes = (bytes(repo[r]) for r in divergencebasecandidates)
1660 msg = _(b"this rebase will cause divergences from: %s") 1657 msg = _(b"this rebase will cause divergences from: %s")