Patchwork [2,of,2] localrepo: avoid unnecessary sorting

login
register
mail settings
Submitter Stanislau Hlebik
Date Feb. 13, 2017, 10:32 a.m.
Message ID <30fd6051a7e441aac16b.1486981978@devvm1840.lla2.facebook.com>
Download mbox | patch
Permalink /patch/18437/
State Accepted
Headers show

Comments

Stanislau Hlebik - Feb. 13, 2017, 10:32 a.m.
# HG changeset patch
# User Stanislau Hlebik <stash@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.

Patch

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)