# HG changeset patch # User Anton Shestakov # Date 1595301821 -28800 # Node ID 56e5dc7d63194b7d0fe69fce5b552361911dcb2c # Parent 0bb75a6c29b17c167f3a7c264889fa5cb22d0af7 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. diff -r 0bb75a6c29b1 -r 56e5dc7d6319 hgext3rd/evolve/rewind.py --- 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))