changeset 804:9b1740825d78

git_handler.get_changed_refs: drop unnecessary computation of local heads It doesn't change between iterations of the generator expression, and it's non-trivial to calculate.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 28 Oct 2014 18:45:02 -0700
parents a74ef8c94235
children 8b663b78e220
files hggit/git_handler.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -946,10 +946,11 @@
 
     def get_changed_refs(self, refs, revs, force):
         new_refs = refs.copy()
+        all_heads = self.local_heads()
 
         #The remote repo is empty and the local one doesn't have bookmarks/tags
         if refs.keys()[0] == 'capabilities^{}':
-            if not self.local_heads():
+            if not all_heads:
                 tip = self.repo.lookup('tip')
                 if tip != nullid:
                     del new_refs['capabilities^{}']
@@ -972,7 +973,7 @@
                 labels = lambda c: ctx.tags()
             prep = lambda itr: [i.replace(' ', '_') for i in itr]
 
-            heads = [t for t in prep(labels(ctx)) if t in self.local_heads()]
+            heads = [t for t in prep(labels(ctx)) if t in all_heads]
             tags = [t for t in prep(labels(ctx)) if t in self.tags]
 
             if not (heads or tags):