##// END OF EJS Templates
revset: better naming of variables containing the value of a single argument...
Mads Kiilerich -
r22944:5aae3dea default
parent child Browse files
Show More
@@ -343,10 +343,10 b' def ancestor(repo, subset, x):'
343 return baseset()
343 return baseset()
344
344
345 def _ancestors(repo, subset, x, followfirst=False):
345 def _ancestors(repo, subset, x, followfirst=False):
346 args = getset(repo, spanset(repo), x)
346 heads = getset(repo, spanset(repo), x)
347 if not args:
347 if not heads:
348 return baseset()
348 return baseset()
349 s = _revancestors(repo, args, followfirst)
349 s = _revancestors(repo, heads, followfirst)
350 return subset.filter(s.__contains__)
350 return subset.filter(s.__contains__)
351
351
352 def ancestors(repo, subset, x):
352 def ancestors(repo, subset, x):
@@ -656,14 +656,14 b' def desc(repo, subset, x):'
656 return subset.filter(matches)
656 return subset.filter(matches)
657
657
658 def _descendants(repo, subset, x, followfirst=False):
658 def _descendants(repo, subset, x, followfirst=False):
659 args = getset(repo, spanset(repo), x)
659 roots = getset(repo, spanset(repo), x)
660 if not args:
660 if not roots:
661 return baseset()
661 return baseset()
662 s = _revdescendants(repo, args, followfirst)
662 s = _revdescendants(repo, roots, followfirst)
663
663
664 # Both sets need to be ascending in order to lazily return the union
664 # Both sets need to be ascending in order to lazily return the union
665 # in the correct order.
665 # in the correct order.
666 base = subset & args
666 base = subset & roots
667 desc = subset & s
667 desc = subset & s
668 result = base + desc
668 result = base + desc
669 if subset.isascending():
669 if subset.isascending():
@@ -692,15 +692,15 b' def destination(repo, subset, x):'
692 is the same as passing all().
692 is the same as passing all().
693 """
693 """
694 if x is not None:
694 if x is not None:
695 args = getset(repo, spanset(repo), x)
695 sources = getset(repo, spanset(repo), x)
696 else:
696 else:
697 args = getall(repo, spanset(repo), x)
697 sources = getall(repo, spanset(repo), x)
698
698
699 dests = set()
699 dests = set()
700
700
701 # subset contains all of the possible destinations that can be returned, so
701 # subset contains all of the possible destinations that can be returned, so
702 # iterate over them and see if their source(s) were provided in the args.
702 # iterate over them and see if their source(s) were provided in the arg set.
703 # Even if the immediate src of r is not in the args, src's source (or
703 # Even if the immediate src of r is not in the arg set, src's source (or
704 # further back) may be. Scanning back further than the immediate src allows
704 # further back) may be. Scanning back further than the immediate src allows
705 # transitive transplants and rebases to yield the same results as transitive
705 # transitive transplants and rebases to yield the same results as transitive
706 # grafts.
706 # grafts.
@@ -720,7 +720,7 b' def destination(repo, subset, x):'
720 # different iteration over subset. Likewise, if the src was already
720 # different iteration over subset. Likewise, if the src was already
721 # selected, the current lineage can be selected without going back
721 # selected, the current lineage can be selected without going back
722 # further.
722 # further.
723 if src in args or src in dests:
723 if src in sources or src in dests:
724 dests.update(lineage)
724 dests.update(lineage)
725 break
725 break
726
726
@@ -1151,9 +1151,9 b' def origin(repo, subset, x):'
1151 for the first operation is selected.
1151 for the first operation is selected.
1152 """
1152 """
1153 if x is not None:
1153 if x is not None:
1154 args = getset(repo, spanset(repo), x)
1154 dests = getset(repo, spanset(repo), x)
1155 else:
1155 else:
1156 args = getall(repo, spanset(repo), x)
1156 dests = getall(repo, spanset(repo), x)
1157
1157
1158 def _firstsrc(rev):
1158 def _firstsrc(rev):
1159 src = _getrevsource(repo, rev)
1159 src = _getrevsource(repo, rev)
@@ -1167,7 +1167,7 b' def origin(repo, subset, x):'
1167 return src
1167 return src
1168 src = prev
1168 src = prev
1169
1169
1170 o = set([_firstsrc(r) for r in args])
1170 o = set([_firstsrc(r) for r in dests])
1171 o -= set([None])
1171 o -= set([None])
1172 return subset & o
1172 return subset & o
1173
1173
General Comments 0
You need to be logged in to leave comments. Login now