Mercurial > evolve
changeset 5545:56e5dc7d6319
rewind: always compute successorsmap
We have had access to rewind targets (predecessors) in this function before,
but having access to current successors (in the form of successorsmap) is also
useful and will be used in following patches.
We're emptying successorsmap when --as-divergence is given to keep the current
behavior. It's done before using it for --dry-run and actual work.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 21 Jul 2020 11:23:41 +0800 |
parents | 0bb75a6c29b1 |
children | 95d00d58885f |
files | hgext3rd/evolve/rewind.py |
diffstat | 1 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/rewind.py Tue Jul 21 01:04:43 2020 +0800 +++ b/hgext3rd/evolve/rewind.py Tue Jul 21 11:23:41 2020 +0800 @@ -93,17 +93,19 @@ targets = _select_rewind_targets(repo, opts) - if not opts['as_divergence']: - for rev in targets: - ctx = unfi[rev] - ssets = obsutil.successorssets(repo, ctx.node(), cache=sscache) - if len(ssets) > 1: - msg = _(b'rewind confused by divergence on %s') % ctx - hint = _(b'solve divergence first or use "--as-divergence"') - raise error.Abort(msg, hint=hint) - if ssets and ssets[0]: - for succ in ssets[0]: - successorsmap[succ].add(ctx.node()) + for rev in targets: + ctx = unfi[rev] + ssets = obsutil.successorssets(repo, ctx.node(), cache=sscache) + if not opts['as_divergence'] and len(ssets) > 1: + msg = _(b'rewind confused by divergence on %s') % ctx + hint = _(b'solve divergence first or use "--as-divergence"') + raise error.Abort(msg, hint=hint) + for sset in ssets: + for succ in sset: + successorsmap[succ].add(ctx.node()) + + if opts['as_divergence']: + successorsmap = {} if opts['dry_run']: ui.status(dryrun(unfi, targets, successorsmap, opts))