changeset 9038:93fe89afc611

localrepo: removed unnecessary revkey sort helper
author Martin Geisler <mg@lazybytes.net>
date Sun, 05 Jul 2009 12:43:40 +0200
parents a232b90ffb51
children 8761863c3118
files mercurial/localrepo.py
diffstat 1 files changed, 3 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Jul 05 11:06:41 2009 +0200
+++ b/mercurial/localrepo.py	Sun Jul 05 12:43:40 2009 +0200
@@ -1707,24 +1707,13 @@
         def identity(x):
             return x
 
-        # A function generating function.  Sets up an environment for the
-        # inner function.
-        def revkey(revlog):
-            # Key to sort a node by it's revision number in the environment's
-            # revision history.  Since the revision number both represents the
-            # most efficient order to read the nodes in, and represents a
-            # topological sorting of the nodes, this function is often useful.
-            def revlog_sort_key(x):
-                return revlog.rev(x)
-            return revlog_sort_key
-
         # If we determine that a particular file or manifest node must be a
         # node that the recipient of the changegroup will already have, we can
         # also assume the recipient will have all the parents.  This function
         # prunes them from the set of missing nodes.
         def prune_parents(revlog, hasset, msngset):
             haslst = list(hasset)
-            haslst.sort(key=revkey(revlog))
+            haslst.sort(key=revlog.rev)
             for node in haslst:
                 parentlst = [p for p in revlog.parents(node) if p != nullid]
                 while parentlst:
@@ -1874,7 +1863,7 @@
             add_extra_nodes(1, msng_mnfst_set)
             msng_mnfst_lst = msng_mnfst_set.keys()
             # Sort the manifestnodes by revision number.
-            msng_mnfst_lst.sort(key=revkey(mnfst))
+            msng_mnfst_lst.sort(key=mnfst.rev)
             # Create a generator for the manifestnodes that calls our lookup
             # and data collection functions back.
             group = mnfst.group(msng_mnfst_lst, lookup_manifest_link,
@@ -1912,7 +1901,7 @@
                     yield changegroup.chunkheader(len(fname))
                     yield fname
                     # Sort the filenodes by their revision #
-                    msng_filenode_lst.sort(key=revkey(filerevlog))
+                    msng_filenode_lst.sort(key=filerevlog.rev)
                     # Create a group generator and only pass in a changenode
                     # lookup function as we need to collect no information
                     # from filenodes.