changeset 27240:94a3d6fdc315

changegroup: clean up file lookup function One case is basically degenerate, so just extract it and make the function clearer.
author Augie Fackler <augie@google.com>
date Fri, 04 Dec 2015 11:38:02 -0500
parents 65c47779bcb5
children ead8e7069998
files mercurial/changegroup.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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():