##// END OF EJS Templates
revset: changed revsets to use spanset...
Lucas Moscovicz -
r20526:9ad6dae6 default
parent child Browse files
Show More
@@ -2567,7 +2567,7 b' def debugrevspec(ui, repo, expr, **opts)'
2567 weight, optimizedtree = revset.optimize(newtree, True)
2567 weight, optimizedtree = revset.optimize(newtree, True)
2568 ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
2568 ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
2569 func = revset.match(ui, expr)
2569 func = revset.match(ui, expr)
2570 for c in func(repo, revset.baseset(range(len(repo)))):
2570 for c in func(repo, revset.spanset(repo)):
2571 ui.write("%s\n" % c)
2571 ui.write("%s\n" % c)
2572
2572
2573 @command('debugsetparents', [], _('REV1 [REV2]'))
2573 @command('debugsetparents', [], _('REV1 [REV2]'))
@@ -232,14 +232,13 b' def rangeset(repo, subset, x, y):'
232 m, n = m[0], n[-1]
232 m, n = m[0], n[-1]
233
233
234 if m < n:
234 if m < n:
235 r = range(m, n + 1)
235 r = spanset(repo, m, n + 1)
236 else:
236 else:
237 r = range(m, n - 1, -1)
237 r = spanset(repo, m, n - 1)
238 s = subset.set()
238 return r & subset
239 return baseset([x for x in r if x in s])
240
239
241 def dagrange(repo, subset, x, y):
240 def dagrange(repo, subset, x, y):
242 r = baseset(repo)
241 r = spanset(repo)
243 xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
242 xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
244 s = subset.set()
243 s = subset.set()
245 return baseset([r for r in xs if r in s])
244 return baseset([r for r in xs if r in s])
@@ -287,7 +286,7 b' def ancestor(repo, subset, x):'
287 """
286 """
288 # i18n: "ancestor" is a keyword
287 # i18n: "ancestor" is a keyword
289 l = getlist(x)
288 l = getlist(x)
290 rl = baseset(repo)
289 rl = spanset(repo)
291 anc = None
290 anc = None
292
291
293 # (getset(repo, rl, i) for i in l) generates a list of lists
292 # (getset(repo, rl, i) for i in l) generates a list of lists
@@ -306,7 +305,7 b' def ancestor(repo, subset, x):'
306 return baseset([])
305 return baseset([])
307
306
308 def _ancestors(repo, subset, x, followfirst=False):
307 def _ancestors(repo, subset, x, followfirst=False):
309 args = getset(repo, baseset(repo), x)
308 args = getset(repo, spanset(repo), x)
310 if not args:
309 if not args:
311 return baseset([])
310 return baseset([])
312 s = set(_revancestors(repo, args, followfirst)) | set(args)
311 s = set(_revancestors(repo, args, followfirst)) | set(args)
@@ -433,7 +432,7 b' def branch(repo, subset, x):'
433 else:
432 else:
434 return lazyset(subset, lambda r: matcher(repo[r].branch()))
433 return lazyset(subset, lambda r: matcher(repo[r].branch()))
435
434
436 s = getset(repo, baseset(repo), x)
435 s = getset(repo, spanset(repo), x)
437 b = set()
436 b = set()
438 for r in s:
437 for r in s:
439 b.add(repo[r].branch())
438 b.add(repo[r].branch())
@@ -596,11 +595,11 b' def desc(repo, subset, x):'
596 return lazyset(subset, matches)
595 return lazyset(subset, matches)
597
596
598 def _descendants(repo, subset, x, followfirst=False):
597 def _descendants(repo, subset, x, followfirst=False):
599 args = getset(repo, baseset(repo), x)
598 args = getset(repo, spanset(repo), x)
600 if not args:
599 if not args:
601 return baseset([])
600 return baseset([])
602 s = set(_revdescendants(repo, args, followfirst)) | set(args)
601 s = set(_revdescendants(repo, args, followfirst)) | set(args)
603 return baseset([r for r in subset if r in s])
602 return subset & s
604
603
605 def descendants(repo, subset, x):
604 def descendants(repo, subset, x):
606 """``descendants(set)``
605 """``descendants(set)``
@@ -620,9 +619,9 b' def destination(repo, subset, x):'
620 is the same as passing all().
619 is the same as passing all().
621 """
620 """
622 if x is not None:
621 if x is not None:
623 args = getset(repo, baseset(repo), x).set()
622 args = getset(repo, spanset(repo), x).set()
624 else:
623 else:
625 args = getall(repo, baseset(repo), x).set()
624 args = getall(repo, spanset(repo), x).set()
626
625
627 dests = set()
626 dests = set()
628
627
@@ -943,7 +942,7 b' def limit(repo, subset, x):'
943 # i18n: "limit" is a keyword
942 # i18n: "limit" is a keyword
944 raise error.ParseError(_("limit expects a number"))
943 raise error.ParseError(_("limit expects a number"))
945 ss = subset.set()
944 ss = subset.set()
946 os = getset(repo, baseset(repo), l[0])
945 os = getset(repo, spanset(repo), l[0])
947 bs = baseset([])
946 bs = baseset([])
948 it = iter(os)
947 it = iter(os)
949 for x in xrange(lim):
948 for x in xrange(lim):
@@ -970,14 +969,14 b' def last(repo, subset, x):'
970 # i18n: "last" is a keyword
969 # i18n: "last" is a keyword
971 raise error.ParseError(_("last expects a number"))
970 raise error.ParseError(_("last expects a number"))
972 ss = subset.set()
971 ss = subset.set()
973 os = getset(repo, baseset(repo), l[0])[-lim:]
972 os = getset(repo, spanset(repo), l[0])[-lim:]
974 return baseset([r for r in os if r in ss])
973 return baseset([r for r in os if r in ss])
975
974
976 def maxrev(repo, subset, x):
975 def maxrev(repo, subset, x):
977 """``max(set)``
976 """``max(set)``
978 Changeset with highest revision number in set.
977 Changeset with highest revision number in set.
979 """
978 """
980 os = getset(repo, baseset(repo), x)
979 os = getset(repo, spanset(repo), x)
981 if os:
980 if os:
982 m = max(os)
981 m = max(os)
983 if m in subset:
982 if m in subset:
@@ -1014,7 +1013,7 b' def minrev(repo, subset, x):'
1014 """``min(set)``
1013 """``min(set)``
1015 Changeset with lowest revision number in set.
1014 Changeset with lowest revision number in set.
1016 """
1015 """
1017 os = getset(repo, baseset(repo), x)
1016 os = getset(repo, spanset(repo), x)
1018 if os:
1017 if os:
1019 m = min(os)
1018 m = min(os)
1020 if m in subset:
1019 if m in subset:
@@ -1078,9 +1077,9 b' def origin(repo, subset, x):'
1078 for the first operation is selected.
1077 for the first operation is selected.
1079 """
1078 """
1080 if x is not None:
1079 if x is not None:
1081 args = getset(repo, baseset(repo), x).set()
1080 args = getset(repo, spanset(repo), x).set()
1082 else:
1081 else:
1083 args = getall(repo, baseset(repo), x).set()
1082 args = getall(repo, spanset(repo), x).set()
1084
1083
1085 def _firstsrc(rev):
1084 def _firstsrc(rev):
1086 src = _getrevsource(repo, rev)
1085 src = _getrevsource(repo, rev)
@@ -1130,7 +1129,7 b' def p1(repo, subset, x):'
1130
1129
1131 ps = set()
1130 ps = set()
1132 cl = repo.changelog
1131 cl = repo.changelog
1133 for r in getset(repo, baseset(repo), x):
1132 for r in getset(repo, spanset(repo), x):
1134 ps.add(cl.parentrevs(r)[0])
1133 ps.add(cl.parentrevs(r)[0])
1135 return subset & ps
1134 return subset & ps
1136
1135
@@ -1148,7 +1147,7 b' def p2(repo, subset, x):'
1148
1147
1149 ps = set()
1148 ps = set()
1150 cl = repo.changelog
1149 cl = repo.changelog
1151 for r in getset(repo, baseset(repo), x):
1150 for r in getset(repo, spanset(repo), x):
1152 ps.add(cl.parentrevs(r)[1])
1151 ps.add(cl.parentrevs(r)[1])
1153 return subset & ps
1152 return subset & ps
1154
1153
@@ -1162,7 +1161,7 b' def parents(repo, subset, x):'
1162
1161
1163 ps = set()
1162 ps = set()
1164 cl = repo.changelog
1163 cl = repo.changelog
1165 for r in getset(repo, baseset(repo), x):
1164 for r in getset(repo, spanset(repo), x):
1166 ps.update(cl.parentrevs(r))
1165 ps.update(cl.parentrevs(r))
1167 return subset & ps
1166 return subset & ps
1168
1167
@@ -534,7 +534,7 b' def revrange(repo, revs):'
534
534
535 # fall through to new-style queries if old-style fails
535 # fall through to new-style queries if old-style fails
536 m = revset.match(repo.ui, spec)
536 m = revset.match(repo.ui, spec)
537 dl = [r for r in m(repo, revset.baseset(repo)) if r not in seen]
537 dl = [r for r in m(repo, revset.spanset(repo)) if r not in seen]
538 l.extend(dl)
538 l.extend(dl)
539 seen.update(dl)
539 seen.update(dl)
540
540
General Comments 0
You need to be logged in to leave comments. Login now