[PATCH 2 of 2] localrepo: avoid unnecessary sorting

Stanislau Hlebik stash at fb.com
Mon Feb 13 05:32:58 EST 2017


# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1486981916 28800
#      Mon Feb 13 02:31:56 2017 -0800
# Node ID 30fd6051a7e441aac16b5ba7b4a19aa3731576f0
# Parent  8bc5ae6cf51408dbd1b789555196f031bfef19d4
localrepo: avoid unnecessary sorting

headrevs output already sorted, no need to sort it again.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1854,7 +1854,7 @@
     def heads(self, start=None):
         if start is None:
             cl = self.changelog
-            headrevs = sorted(cl.headrevs(), reverse=True)
+            headrevs = reversed(cl.headrevs())
             return [cl.node(rev) for rev in headrevs]
 
         heads = self.changelog.heads(start)


More information about the Mercurial-devel mailing list