[PATCH 5 of 6] ancestor: rename local aliases of heapq functions in _lazyancestorsiter()

Yuya Nishihara yuya at tcha.org
Tue Sep 11 19:02:10 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1536673011 -32400
#      Tue Sep 11 22:36:51 2018 +0900
# Node ID a7b608b84035fcd1d25ca9bac3c8b1cfb1b7f4c3
# Parent  d346926526c0ca1d35b549d8f47840d123879249
ancestor: rename local aliases of heapq functions in _lazyancestorsiter()

The original names no longer look pretty. Just call them as heap*() instead.

diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
--- a/mercurial/ancestor.py
+++ b/mercurial/ancestor.py
@@ -262,8 +262,8 @@ class incrementalmissingancestors(object
 # Extracted from lazyancestors.__iter__ to avoid a reference cycle
 def _lazyancestorsiter(parentrevs, initrevs, stoprev, inclusive):
     seen = {nullrev}
-    schedule = heapq.heappush
-    nextitem = heapq.heappop
+    heappush = heapq.heappush
+    heappop = heapq.heappop
     see = seen.add
 
     if inclusive:
@@ -276,10 +276,10 @@ def _lazyancestorsiter(parentrevs, initr
         for r in initrevs:
             p1, p2 = parentrevs(r)
             if p1 not in seen:
-                schedule(visit, -p1)
+                heappush(visit, -p1)
                 see(p1)
             if p2 not in seen:
-                schedule(visit, -p2)
+                heappush(visit, -p2)
                 see(p2)
 
     while visit:
@@ -294,13 +294,13 @@ def _lazyancestorsiter(parentrevs, initr
             if current - p1 == 1:
                 visit[0] = -p1
             else:
-                nextitem(visit)
-                schedule(visit, -p1)
+                heappop(visit)
+                heappush(visit, -p1)
             see(p1)
         else:
-            nextitem(visit)
+            heappop(visit)
         if p2 not in seen:
-            schedule(visit, -p2)
+            heappush(visit, -p2)
             see(p2)
 
 class lazyancestors(object):


More information about the Mercurial-devel mailing list