changeset 30905:6037caa6a2f3

localrepo: cache self.changelog in local variable Repeated self.changelog lookups can incur overhead. Let's cache it in the separate variable.
author Stanislau Hlebik <stash@fb.com>
date Mon, 13 Feb 2017 02:26:18 -0800
parents 76a1e735449c
children 72f25e17af9d
files mercurial/localrepo.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Feb 07 13:11:30 2017 -0800
+++ b/mercurial/localrepo.py	Mon Feb 13 02:26:18 2017 -0800
@@ -1853,8 +1853,9 @@
 
     def heads(self, start=None):
         if start is None:
-            headrevs = sorted(self.changelog.headrevs(), reverse=True)
-            return [self.changelog.node(rev) for rev in headrevs]
+            cl = self.changelog
+            headrevs = sorted(cl.headrevs(), reverse=True)
+            return [cl.node(rev) for rev in headrevs]
 
         heads = self.changelog.heads(start)
         # sort the output in rev descending order