changeset 32999:08e2793d9f65

dagop: bulk rename variables in revancestors() generator - h -> pendingheap: "h" seems too short for variable of long lifetime - current -> currev: future patches will add current "depth" variable - parent -> prev or pctx: short lifetime, follows common naming rules
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Jun 2017 17:22:57 +0900
parents c7da57bbae96
children d3d36bcdf036
files mercurial/dagop.py
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dagop.py	Sun Jun 18 17:16:02 2017 +0900
+++ b/mercurial/dagop.py	Sun Jun 18 17:22:57 2017 +0900
@@ -31,30 +31,30 @@
     # without fully computing the input revs
     revs.sort(reverse=True)
     irevs = iter(revs)
-    h = []
+    pendingheap = []
 
     inputrev = next(irevs, None)
     if inputrev is not None:
-        heapq.heappush(h, -inputrev)
+        heapq.heappush(pendingheap, -inputrev)
 
     seen = set()
-    while h:
-        current = -heapq.heappop(h)
-        if current == inputrev:
+    while pendingheap:
+        currev = -heapq.heappop(pendingheap)
+        if currev == inputrev:
             inputrev = next(irevs, None)
             if inputrev is not None:
-                heapq.heappush(h, -inputrev)
-        if current not in seen:
-            seen.add(current)
-            yield current
+                heapq.heappush(pendingheap, -inputrev)
+        if currev not in seen:
+            seen.add(currev)
+            yield currev
             try:
-                for parent in cl.parentrevs(current)[:cut]:
-                    if parent != node.nullrev:
-                        heapq.heappush(h, -parent)
+                for prev in cl.parentrevs(currev)[:cut]:
+                    if prev != node.nullrev:
+                        heapq.heappush(pendingheap, -prev)
             except error.WdirUnsupported:
-                for parent in repo[current].parents()[:cut]:
-                    if parent.rev() != node.nullrev:
-                        heapq.heappush(h, -parent.rev())
+                for pctx in repo[currev].parents()[:cut]:
+                    if pctx.rev() != node.nullrev:
+                        heapq.heappush(pendingheap, -pctx.rev())
 
 def revancestors(repo, revs, followfirst):
     """Like revlog.ancestors(), but supports followfirst."""