changegroup: clean up changelog callback
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 10 Aug 2018 12:42:00 -0700
changeset 39237 3634ed953a42
parent 39236 a79279a21b0a
child 39238 cc957b9dc335
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
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Fri Aug 10 12:08:45 2018 -0700
+++ b/mercurial/changegroup.py	Fri Aug 10 12:42:00 2018 -0700
@@ -953,7 +953,7 @@
         # 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 @@
                 # 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