[PATCH 4 of 6 RFC] shrink: rename some local variables for consistency

Greg Ward greg-hg at gerg.ca
Wed Jan 20 21:15:31 CST 2010


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1264041458 18000
# Node ID f11a5a936b64f2ce60fb6526d8d8ff8092186f69
# Parent  76f48d732ead239df25a913cbeeedb45b71cd657
shrink: rename some local variables for consistency

diff --git a/contrib/shrink-revlog.py b/contrib/shrink-revlog.py
old mode 100755
new mode 100644
--- a/contrib/shrink-revlog.py
+++ b/contrib/shrink-revlog.py
@@ -54,7 +54,7 @@
     # the algorithm
     ui.write('sorting ...')
     visit = root
-    ret = []
+    result = []
 
     # suboptimal: nodes whose predecessor is not first parent
     # p2pred: nodes whose predecessor is second parent (special case of
@@ -62,23 +62,23 @@
     suboptimal = p2pred = 0
 
     while visit:
-        i = visit.pop(0)
-        # revlog will compute delta relative to ret[-1], so keep track
+        cur = visit.pop(0)
+        # revlog will compute delta relative to result[-1], so keep track
         # of nodes where this might result in a large delta
-        parents = rl.parentrevs(i)
-        if ret:
-            if ret[-1] != parents[0]:
+        parents = rl.parentrevs(cur)
+        if result:
+            if result[-1] != parents[0]:
                 suboptimal += 1
-            if ret[-1] == parents[1]:
+            if result[-1] == parents[1]:
                 p2pred += 1
 
-        ret.append(i)
-        if i not in children:
+        result.append(cur)
+        if cur not in children:
             # This only happens if some node's p1 == p2, which can
             # happen in the manifest in certain circumstances.
             continue
         next = []
-        for c in children.pop(i):
+        for c in children.pop(cur):
             parents_unseen = [p for p in rl.parentrevs(c)
                               if p != node.nullrev and p in children]
             if len(parents_unseen) == 0:
@@ -87,7 +87,7 @@
     ui.write('\n')
     ui.write('%d suboptimal nodes\n' % suboptimal)
     ui.write('%d p2 is predecessor\n' % p2pred)
-    return ret
+    return result
 
 def toposort_parentdelta(ui, rl):
     # map rev to list of parent revs (p2 first)


More information about the Mercurial-devel mailing list