changeset 26674:fd4a38bd7e49

rebase: use a direct reference to repo.changelog Accessing 'repo.changelog' have a small overhead because we double check that the filtering did not changed. As we make multiple use of this into loops, we should avoid doing the lookup/check every time. This also make the code tidier.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 14 Oct 2015 23:42:15 +0100
parents ab1af5e7d734
children b73eb98c0243
files hgext/rebase.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Wed Oct 14 22:21:05 2015 -0400
+++ b/hgext/rebase.py	Wed Oct 14 23:42:15 2015 +0100
@@ -1161,19 +1161,20 @@
     # Build a mapping succesor => obsolete nodes for the obsolete
     # nodes to be rebased
     allsuccessors = {}
+    cl = repo.changelog
     for r in rebasesetrevs:
         n = repo[r]
         if n.obsolete():
-            node = repo.changelog.node(r)
+            node = cl.node(r)
             for s in obsolete.allsuccessors(repo.obsstore, [node]):
-                allsuccessors[repo.changelog.rev(s)] = repo.changelog.rev(node)
+                allsuccessors[cl.rev(s)] = cl.rev(node)
 
     if allsuccessors:
         # Look for successors of obsolete nodes to be rebased among
         # the ancestors of dest
-        ancs = repo.changelog.ancestors([repo[dest].rev()],
-                                        stoprev=min(allsuccessors),
-                                        inclusive=True)
+        ancs = cl.ancestors([repo[dest].rev()],
+                            stoprev=min(allsuccessors),
+                            inclusive=True)
         for s in allsuccessors:
             if s in ancs:
                 obsoletenotrebased[allsuccessors[s]] = s