Patchwork [2,of,2] changegroup: use changelogrevision()

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 2, 2016, 1:29 a.m.
Message ID <0bf5f704d2d99965df47.1478050178@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/17263/
State Accepted
Headers show

Comments

Gregory Szorc - Nov. 2, 2016, 1:29 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1478050149 25200
#      Tue Nov 01 18:29:09 2016 -0700
# Node ID 0bf5f704d2d99965df476e5e90a517b805ee08aa
# Parent  9cd491f108689228e93b1247772aba56786afcd7
changegroup: use changelogrevision()

Using offsets for accessing changelog entries isn't very readable.
As a bonus, changelog.changelogrevision() also accepts a revision,
so we don't need to perform the inline node resolution either.
Pierre-Yves David - Nov. 3, 2016, 3:44 p.m.
On 11/02/2016 02:29 AM, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1478050149 25200
> #      Tue Nov 01 18:29:09 2016 -0700
> # Node ID 0bf5f704d2d99965df476e5e90a517b805ee08aa
> # Parent  9cd491f108689228e93b1247772aba56786afcd7
> changegroup: use changelogrevision()

I've pushed this two.

I would be happier to see some performance number attached, but they 
seems reasonable enough that I took them.

Thanks!

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -334,7 +334,7 @@  class cg1unpacker(object):
                     ml = repo.manifestlog
                     # validate incoming csets have their manifests
                     for cset in xrange(clstart, clend):
-                        mfnode = cl.read(cl.node(cset))[0]
+                        mfnode = cl.changelogrevision(cset).manifest
                         mfest = ml[mfnode].readdelta()
                         # store file nodes we must see
                         for f, n in mfest.iteritems():