Mercurial > public > mercurial-scm > hg-stable
diff mercurial/setdiscovery.py @ 39192:5b32b3c618b2
setdiscovery: don't use dagutil for rev -> node conversions
We don't need to use dagutil to perform a simple rev -> node
conversion.
I haven't measured, but the new code is likely faster, as we
avoid extra function calls and avoid some attribute lookups.
Differential Revision: https://phab.mercurial-scm.org/D4304
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 16 Aug 2018 19:39:47 +0000 |
parents | ef692614e601 |
children | 858a12846f4f |
line wrap: on
line diff
--- a/mercurial/setdiscovery.py Thu Aug 16 19:23:24 2018 +0000 +++ b/mercurial/setdiscovery.py Thu Aug 16 19:39:47 2018 +0000 @@ -142,7 +142,9 @@ roundtrips = 0 cl = local.changelog + clnode = cl.node localsubset = None + if ancestorsof is not None: rev = local.changelog.rev localsubset = [rev(n) for n in ancestorsof] @@ -159,7 +161,7 @@ with remote.commandexecutor() as e: fheads = e.callcommand('heads', {}) fknown = e.callcommand('known', { - 'nodes': dag.externalizeall(sample), + 'nodes': [clnode(r) for r in sample], }) srvheadhashes, yesno = fheads.result(), fknown.result() @@ -176,12 +178,12 @@ srvheads = dag.internalizeall(srvheadhashes, filterunknown=True) if len(srvheads) == len(srvheadhashes): ui.debug("all remote heads known locally\n") - return (srvheadhashes, False, srvheadhashes,) + return srvheadhashes, False, srvheadhashes if len(sample) == len(ownheads) and all(yesno): ui.note(_("all local heads known remotely\n")) - ownheadhashes = dag.externalizeall(ownheads) - return (ownheadhashes, True, srvheadhashes,) + ownheadhashes = [clnode(r) for r in ownheads] + return ownheadhashes, True, srvheadhashes # full blown discovery @@ -235,7 +237,7 @@ with remote.commandexecutor() as e: yesno = e.callcommand('known', { - 'nodes': dag.externalizeall(sample), + 'nodes': [clnode(r) for r in sample], }).result() full = True @@ -268,4 +270,5 @@ return ({nullid}, True, srvheadhashes,) anyincoming = (srvheadhashes != [nullid]) - return dag.externalizeall(result), anyincoming, srvheadhashes + result = {clnode(r) for r in result} + return result, anyincoming, srvheadhashes