Mercurial > evolve
changeset 5049:1b393870c6b9
evolve: preliminary indentation
The whole code will end up in a try/except clause. We pre-indent the code to
clarify the next patch.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 18 Dec 2019 16:21:37 +0100 |
parents | a8ac174010a5 |
children | f29bd1c7e457 |
files | hgext3rd/evolve/evolvecmd.py |
diffstat | 1 files changed, 35 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py Fri Dec 20 14:08:37 2019 +0700 +++ b/hgext3rd/evolve/evolvecmd.py Wed Dec 18 16:21:37 2019 +0100 @@ -122,42 +122,43 @@ ui.warn(_(b"cannot solve instability of %s, skipping\n") % orig) return (False, b".") obs = pctx - newer = obsutil.successorssets(repo, obs.node()) - # search of a parent which is not killed, but also isn't the orig - while not newer or newer[0][0] == orig.node(): - ui.debug(b"stabilize target %s is plain dead," - b" trying to stabilize on its parent\n" % - obs) - obs = obs.p1() + if True: newer = obsutil.successorssets(repo, obs.node()) - if len(newer) > 1: - msg = _(b"skipping %s: divergent rewriting. can't choose " - b"destination\n") % obs - ui.write_err(msg) - return (False, b".") - targets = newer[0] - assert targets - if len(targets) > 1: - # split target, figure out which one to pick, are they all in line? - targetrevs = [repo[r].rev() for r in targets] - roots = repo.revs(b'roots(%ld)', targetrevs) - heads = repo.revs(b'heads(%ld)', targetrevs) - if len(roots) > 1 or len(heads) > 1: - cheader = _(b"ancestor '%s' split over multiple topological" - b" branches.\nchoose an evolve destination:") % orig - selectedrev = utility.revselectionprompt(ui, repo, list(heads), - cheader) - if selectedrev is None: - msg = _(b"could not solve instability, " - b"ambiguous destination: " - b"parent split across two branches\n") - ui.write_err(msg) - return (False, b".") - target = repo[selectedrev] + # search of a parent which is not killed, but also isn't the orig + while not newer or newer[0][0] == orig.node(): + ui.debug(b"stabilize target %s is plain dead," + b" trying to stabilize on its parent\n" % + obs) + obs = obs.p1() + newer = obsutil.successorssets(repo, obs.node()) + if len(newer) > 1: + msg = _(b"skipping %s: divergent rewriting. can't choose " + b"destination\n") % obs + ui.write_err(msg) + return (False, b".") + targets = newer[0] + assert targets + if len(targets) > 1: + # split target, figure out which one to pick, are they all in line? + targetrevs = [repo[r].rev() for r in targets] + roots = repo.revs(b'roots(%ld)', targetrevs) + heads = repo.revs(b'heads(%ld)', targetrevs) + if len(roots) > 1 or len(heads) > 1: + cheader = _(b"ancestor '%s' split over multiple topological" + b" branches.\nchoose an evolve destination:") % orig + selectedrev = utility.revselectionprompt(ui, repo, list(heads), + cheader) + if selectedrev is None: + msg = _(b"could not solve instability, " + b"ambiguous destination: " + b"parent split across two branches\n") + ui.write_err(msg) + return (False, b".") + target = repo[selectedrev] + else: + target = repo[heads.first()] else: - target = repo[heads.first()] - else: - target = targets[0] + target = targets[0] target = repo[target] if not ui.quiet or confirm: repo.ui.write(_(b'move:'), label=b'evolve.operation')