localrepo: cache self.changelog in local variable
Repeated self.changelog lookups can incur overhead. Let's cache it in the
separate variable.
--- 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