revset: better naming of variables containing the value of a single argument
authorMads Kiilerich <madski@unity3d.com>
Wed, 15 Oct 2014 04:08:06 +0200
changeset 22944 5aae3dea8044
parent 22943 117e81871113
child 22945 3232f92360d4
revset: better naming of variables containing the value of a single argument Calling them args is not helpful.
mercurial/revset.py
--- a/mercurial/revset.py	Tue Oct 14 14:42:25 2014 -0400
+++ b/mercurial/revset.py	Wed Oct 15 04:08:06 2014 +0200
@@ -343,10 +343,10 @@
     return baseset()
 
 def _ancestors(repo, subset, x, followfirst=False):
-    args = getset(repo, spanset(repo), x)
-    if not args:
+    heads = getset(repo, spanset(repo), x)
+    if not heads:
         return baseset()
-    s = _revancestors(repo, args, followfirst)
+    s = _revancestors(repo, heads, followfirst)
     return subset.filter(s.__contains__)
 
 def ancestors(repo, subset, x):
@@ -656,14 +656,14 @@
     return subset.filter(matches)
 
 def _descendants(repo, subset, x, followfirst=False):
-    args = getset(repo, spanset(repo), x)
-    if not args:
+    roots = getset(repo, spanset(repo), x)
+    if not roots:
         return baseset()
-    s = _revdescendants(repo, args, followfirst)
+    s = _revdescendants(repo, roots, followfirst)
 
     # Both sets need to be ascending in order to lazily return the union
     # in the correct order.
-    base = subset & args
+    base = subset & roots
     desc = subset & s
     result = base + desc
     if subset.isascending():
@@ -692,15 +692,15 @@
     is the same as passing all().
     """
     if x is not None:
-        args = getset(repo, spanset(repo), x)
+        sources = getset(repo, spanset(repo), x)
     else:
-        args = getall(repo, spanset(repo), x)
+        sources = getall(repo, spanset(repo), x)
 
     dests = set()
 
     # subset contains all of the possible destinations that can be returned, so
-    # iterate over them and see if their source(s) were provided in the args.
-    # Even if the immediate src of r is not in the args, src's source (or
+    # iterate over them and see if their source(s) were provided in the arg set.
+    # Even if the immediate src of r is not in the arg set, src's source (or
     # further back) may be.  Scanning back further than the immediate src allows
     # transitive transplants and rebases to yield the same results as transitive
     # grafts.
@@ -720,7 +720,7 @@
             # different iteration over subset.  Likewise, if the src was already
             # selected, the current lineage can be selected without going back
             # further.
-            if src in args or src in dests:
+            if src in sources or src in dests:
                 dests.update(lineage)
                 break
 
@@ -1151,9 +1151,9 @@
     for the first operation is selected.
     """
     if x is not None:
-        args = getset(repo, spanset(repo), x)
+        dests = getset(repo, spanset(repo), x)
     else:
-        args = getall(repo, spanset(repo), x)
+        dests = getall(repo, spanset(repo), x)
 
     def _firstsrc(rev):
         src = _getrevsource(repo, rev)
@@ -1167,7 +1167,7 @@
                 return src
             src = prev
 
-    o = set([_firstsrc(r) for r in args])
+    o = set([_firstsrc(r) for r in dests])
     o -= set([None])
     return subset & o