# HG changeset patch # User Pierre-Yves David # Date 1577387821 -3600 # Node ID 1403cc7c2cee0ebbf96643d705b92f7690dc9606 # Parent 421b295e32b4ccdd4871dbbfd6af7c3cb334a0da 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. diff -r 421b295e32b4 -r 1403cc7c2cee hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Thu Nov 28 19:01:28 2019 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Thu Dec 26 20:17:01 2019 +0100 @@ -377,32 +377,32 @@ 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 @@ # 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 @@ 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