> On Apr 27, 2018, at 11:30, Kevin Bullock <kbullock+mercur...@ringworld.org> 
> wrote:
> 
>> On Apr 26, 2018, at 10:59, Augie Fackler <r...@durin42.com> wrote:
>> 
>> # HG changeset patch
>> # User Augie Fackler <r...@durin42.com>
>> # Date 1524713796 14400
>> #      Wed Apr 25 23:36:36 2018 -0400
>> # Node ID c8dd55d63f9e56d62db3ff1e1b0a8fef228fd19f
>> # Parent  66e6638d2a6e78f3af813a274eadbd90679b888e
>> land: fix bug we see when we merge, rather than rebase
>> 
>> I triggered this when I tagged 4.6rc1 concurrent with 8c8b6d13949a
>> being landed and accepted. That change was only a doc change, so it
>> wasn't worth redoing the RC, but then the tagging revision got stuck
>> because it wasn't a child of a head in the repo.
>> 
>> Unfortunately, I couldn't figure out how to fix this bug without what
>> amounts to a ground-up rewrite of the land script. Sigh.
> 
> Thanks for poking at this. Code LGTM but I'm getting weird test failures:

Very odd. I promise they pass on my machine, that looks like you have a broken 
run-tests?

[...]

> Also some nitpicks/suggestions, none blocking.
> 
>> @@ -32,29 +35,64 @@ for l in os.popen("hg log -R %s -r 'defa
>> 
>> take = []
>> takelog = ""
>> -while True:
>> -    hit = False
>> -    for n in cq.draft():
>> -        a = cq.accepted(n)
>> -        if not a:
>> -            logging.debug("%s not accepted, skipping", n)
>> -            continue
>> +
>> +def _destcontains(node):
>> +    try:
>> +        return subprocess.check_output(
>> +            ['hg', 'log', '-R', dest, '-r', node, '-T.'],
>> +            stderr=subprocess.STDOUT) == '.'
> 
> Would be nice if this took a list of nodes.

I'm not sure it'd actually /help/ in the calling contexts though. Punting.

> 
>> +    except subprocess.CalledProcessError:
>> +        return False
>> +
>> +# Find all accepted revisions
>> +all_accepted = [n for n in cq.draft() if cq.accepted(n)]
>> +info = json.load(os.popen("hg log -R %s -r '%s' -Tjson" % (
>> +    conf.source, ' + '.join(all_accepted))))
> 
> You're using ' + '.join(all_accepted) enough times that it probably merits a 
> name. Maybe also a helper function for doing 'hg log -R {conf.source} -r 
> {revset} -T {template}'.

Sure.

> 
>> +# dict of node: its parents.
>> +parents = {i['node']: i['parents'] for i in info}
>> 
>> -        if cq.parent(n) not in heads:
>> -            logging.debug("last public ancestor of %s not in %s, skipping",
>> -                          n, dest)
>> -            continue
>> +# Identify heads and roots of accepted revision ranges
>> +accepted_roots = {r.strip() for r in os.popen(
>> +    "hg log -R %s -r 'roots(%s)' -T'{node}\\n'" % (
>> +        conf.source, ' + '.join(all_accepted)))}
>> +accepted_heads = [h.strip() for h in os.popen(
>> +    "hg log -R %s -r 'heads(%s)' -T'{node}\\n'" % (
>> +        conf.source, ' + '.join(all_accepted)))]
>> +# Condense accepted revisions down into accepted ranges
>> +range_ = collections.namedtuple('range', 'roots head')
> 
> A more specific name would be nice here.

Done. Sending V2 shortly...

> 
> pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
> Kevin R. Bullock

_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to