# HG changeset patch # User Anton Shestakov # Date 1590407854 -28800 # Node ID 239071adc54f91828e4c184f886d6daea4849b88 # Parent 25b746aea135f726441c7a8b28c2ba23898e70a0 rewind: rename _select_rewinded() to _select_rewind_targets() diff -r 25b746aea135 -r 239071adc54f hgext3rd/evolve/rewind.py --- a/hgext3rd/evolve/rewind.py Fri Jul 24 10:50:53 2020 +0200 +++ b/hgext3rd/evolve/rewind.py Mon May 25 19:57:34 2020 +0800 @@ -88,10 +88,10 @@ # stay on the safe side: prevent local case in case we need to upgrade cmdutil.bailifchanged(repo) - rewinded = _select_rewinded(repo, opts) + targets = _select_rewind_targets(repo, opts) if not opts['as_divergence']: - for rev in rewinded: + for rev in targets: ctx = unfi[rev] ssets = obsutil.successorssets(repo, ctx.node(), cache=sscache) if 1 < len(ssets): @@ -106,7 +106,7 @@ with repo.transaction(b'rewind'): oldctx = repo[b'.'] - for rev in sorted(rewinded): + for rev in sorted(targets): ctx = unfi[rev] rewindmap[ctx.node()] = _revive_revision(unfi, rev, rewindmap) @@ -156,34 +156,34 @@ else: hg.updaterepo(repo, update_target, False) - repo.ui.status(_(b'rewinded to %d changesets\n') % len(rewinded)) + repo.ui.status(_(b'rewinded to %d changesets\n') % len(targets)) if relationships: repo.ui.status(_(b'(%d changesets obsoleted)\n') % len(relationships)) if update_target is not None and not opts.get('keep'): ui.status(_(b'working directory is now at %s\n') % repo[b'.']) -def _select_rewinded(repo, opts): - """select the revision we shoudl rewind to +def _select_rewind_targets(repo, opts): + """select the revisions we should rewind to """ unfi = repo.unfiltered() - rewinded = set() + targets = set() revsto = opts.get('to') revsfrom = opts.get('from') if not (revsto or revsfrom): revsfrom.append(b'.') if revsto: - rewinded.update(scmutil.revrange(repo, revsto)) + targets.update(scmutil.revrange(repo, revsto)) if revsfrom: succs = scmutil.revrange(repo, revsfrom) - rewinded.update(unfi.revs(b'predecessors(%ld)', succs)) + targets.update(unfi.revs(b'predecessors(%ld)', succs)) - if not rewinded: + if not targets: raise error.Abort(b'no revision to rewind to') if not opts['exact']: - rewinded = unfi.revs(b'obsolete() and ::%ld', rewinded) + targets = unfi.revs(b'obsolete() and ::%ld', targets) - return sorted(rewinded) + return sorted(targets) def _revive_revision(unfi, rev, rewindmap): """rewind a single revision rev.