Commit 0769dbf3 authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

evolve: rename some variable ahead of time

A refactoring of the content divergence resolution in on its way. use a
distinctive name for some variable early to make the change easier to read
later.
parent 421b295e32b4
......@@ -377,32 +377,32 @@ def _solvedivergent(ui, repo, divergent, evolvestate, displayer, dryrun=False,
ui.write_err(hint)
return (False, b".")
otherp1 = other.p1().rev()
divp1 = divergent.p1().rev()
succsotherp1 = other.p1().rev()
succsdivp1 = divergent.p1().rev()
# finding single successors of otherp1 and divp1
try:
otherp1 = utility._singlesuccessor(repo, other.p1())
succsotherp1 = utility._singlesuccessor(repo, other.p1())
except utility.MultipleSuccessorsError:
pass
try:
divp1 = utility._singlesuccessor(repo, divergent.p1())
succsdivp1 = utility._singlesuccessor(repo, divergent.p1())
except utility.MultipleSuccessorsError:
pass
# the changeset on which resolution changeset will be based on
resolutionparent = repo[divp1].node()
resolutionparent = repo[succsdivp1].node()
# the nullrev has to be handled specially because -1 is overloaded to both
# mean nullrev (this meaning is used for the result of changectx.rev(), as
# called above) and the tipmost revision (this meaning is used for the %d
# format specifier, as used below)
if nodemod.nullrev in (otherp1, divp1):
# nullrev is the only possible ancestor if otherp1 or divp1 is nullrev
if nodemod.nullrev in (succsotherp1, succsdivp1):
# nullrev is the only possible ancestor if succsotherp1 or succsdivp1 is nullrev
gca = [nodemod.nullrev]
else:
gca = repo.revs(b"ancestor(%d, %d)" % (otherp1, divp1))
gca = repo.revs(b"ancestor(%d, %d)" % (succsotherp1, succsdivp1))
# divonly: non-obsolete csets which are topological ancestor of "divergent"
# but not "other"
divonly = repo.revs(b"only(%d, %d) - obsolete()" % (divergent.rev(),
......@@ -430,8 +430,8 @@ def _solvedivergent(ui, repo, divergent, evolvestate, displayer, dryrun=False,
# for 2) we will relocate one which is behind to the parent of ahead one and
# then solve the content-divergence the way we solve 1)
# for 3) and 4), we still have to decide
if otherp1 in gca and divp1 in gca:
if otherp1 == other.p1().rev() and divp1 == divergent.p1().rev():
if succsotherp1 in gca and succsdivp1 in gca:
if succsotherp1 == other.p1().rev() and succsdivp1 == divergent.p1().rev():
# both are on the same parents
pass
else:
......@@ -446,16 +446,16 @@ def _solvedivergent(ui, repo, divergent, evolvestate, displayer, dryrun=False,
if not haspubdiv:
# can't swap when public divergence, as public can't move
divergent, other = swapnodes(divergent, other)
resolutionparent = repo[otherp1].node()
resolutionparent = repo[succsotherp1].node()
elif divonly:
relocatereq = True
else:
# no extra cset on either side; so not considering relocation
pass
elif otherp1 in gca and divp1 not in gca:
elif succsotherp1 in gca and succsdivp1 not in gca:
relocatereq = True
pass
elif divp1 in gca and otherp1 not in gca:
elif succsdivp1 in gca and succsotherp1 not in gca:
relocatereq = True
# When public branch is behind to the mutable branch, for now we
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment