changegroup: clean up file lookup function
authorAugie Fackler <augie@google.com>
Fri, 04 Dec 2015 11:38:02 -0500
changeset 27240 94a3d6fdc315
parent 27239 65c47779bcb5
child 27241 ead8e7069998
changegroup: clean up file lookup function One case is basically degenerate, so just extract it and make the function clearer.
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Fri Dec 04 10:55:46 2015 -0500
+++ b/mercurial/changegroup.py	Fri Dec 04 11:38:02 2015 -0500
@@ -694,8 +694,11 @@
         mfs.clear()
         clrevs = set(cl.rev(x) for x in clnodes)
 
-        def linknodes(filerevlog, fname):
-            if fastpathlinkrev:
+        if not fastpathlinkrev:
+            def linknodes(unused, fname):
+                return fnodes.get(fname, {})
+        else:
+            def linknodes(filerevlog, fname):
                 llr = filerevlog.linkrev
                 def genfilenodes():
                     for r in filerevlog:
@@ -703,7 +706,6 @@
                         if linkrev in clrevs:
                             yield filerevlog.node(r), cl.node(linkrev)
                 return dict(genfilenodes())
-            return fnodes.get(fname, {})
 
         changedfiles = set()
         for x in mfchangedfiles.itervalues():