# HG changeset patch # User Gregory Szorc # Date 2018-08-10 19:42:00 # Node ID 3634ed953a42b9cfa5852b6b2498a4098fe4b64f # Parent a79279a21b0a1812318a34e5f58d52d24232d47d changegroup: clean up changelog callback changelog.read() calls changelog.changelogrevion() then turns it into a tuple. Let's call changelogrevision() directly and used named attributes to make code easier to read. While we're here, also change some variable names to make code easier to read. Differential Revision: https://phab.mercurial-scm.org/D4270 diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -953,7 +953,7 @@ class cgpacker(object): # manifest nodes. # Returns the linkrev node (identity in the changelog case). def lookupcl(x): - c = cl.read(x) + c = cl.changelogrevision(x) clrevorder[x] = len(clrevorder) if self._ellipses: @@ -963,29 +963,29 @@ class cgpacker(object): # have sent. if (x in self._fullclnodes or cl.rev(x) in self._precomputedellipsis): - n = c[0] + + manifestnode = c.manifest # Record the first changeset introducing this manifest # version. - mfs.setdefault(n, x) + mfs.setdefault(manifestnode, x) # Set this narrow-specific dict so we have the lowest # manifest revnum to look up for this cl revnum. (Part of # mapping changelog ellipsis parents to manifest ellipsis # parents) - clrevtomanifestrev.setdefault(cl.rev(x), mfl.rev(n)) + clrevtomanifestrev.setdefault( + cl.rev(x), mfl.rev(manifestnode)) # We can't trust the changed files list in the changeset if the # client requested a shallow clone. if self._isshallow: - changedfiles.update(mfl[c[0]].read().keys()) + changedfiles.update(mfl[c.manifest].read().keys()) else: - changedfiles.update(c[3]) + changedfiles.update(c.files) else: - - n = c[0] # record the first changeset introducing this manifest version - mfs.setdefault(n, x) + mfs.setdefault(c.manifest, x) # Record a complete list of potentially-changed files in # this manifest. - changedfiles.update(c[3]) + changedfiles.update(c.files) return x