Mercurial > evolve
changeset 5443:239071adc54f
rewind: rename _select_rewinded() to _select_rewind_targets()
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 25 May 2020 19:57:34 +0800 |
parents | 25b746aea135 |
children | 5174daed97c2 |
files | hgext3rd/evolve/rewind.py |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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.