##// END OF EJS Templates
revset: added intersection to baseset class...
Lucas Moscovicz -
r20367:2ac278aa default
parent child Browse files
Show More
@@ -407,8 +407,7 b' def bookmark(repo, subset, x):'
407 407 bmrevs = set()
408 408 for bmrev in matchrevs:
409 409 bmrevs.add(repo[bmrev].rev())
410 s = subset.set()
411 return baseset([r for r in s if r in bmrevs])
410 return subset & bmrevs
412 411
413 412 bms = set([repo[r].rev()
414 413 for r in repo._bookmarks.values()])
@@ -455,7 +454,7 b' def bumped(repo, subset, x):'
455 454 # i18n: "bumped" is a keyword
456 455 getargs(x, 0, 0, _("bumped takes no arguments"))
457 456 bumped = obsmod.getrevs(repo, 'bumped')
458 return baseset([r for r in subset if r in bumped])
457 return subset & bumped
459 458
460 459 def bundle(repo, subset, x):
461 460 """``bundle()``
@@ -467,7 +466,7 b' def bundle(repo, subset, x):'
467 466 bundlerevs = repo.changelog.bundlerevs
468 467 except AttributeError:
469 468 raise util.Abort(_("no bundle provided - specify with -R"))
470 return baseset([r for r in subset if r in bundlerevs])
469 return subset & bundlerevs
471 470
472 471 def checkstatus(repo, subset, pat, field):
473 472 m = None
@@ -520,7 +519,7 b' def children(repo, subset, x):'
520 519 """
521 520 s = getset(repo, baseset(repo), x).set()
522 521 cs = _children(repo, subset, s)
523 return baseset([r for r in subset if r in cs])
522 return subset & cs
524 523
525 524 def closed(repo, subset, x):
526 525 """``closed()``
@@ -690,7 +689,7 b' def extinct(repo, subset, x):'
690 689 # i18n: "extinct" is a keyword
691 690 getargs(x, 0, 0, _("extinct takes no arguments"))
692 691 extincts = obsmod.getrevs(repo, 'extinct')
693 return baseset([r for r in subset if r in extincts])
692 return subset & extincts
694 693
695 694 def extra(repo, subset, x):
696 695 """``extra(label, [value])``
@@ -921,7 +920,7 b' def hidden(repo, subset, x):'
921 920 # i18n: "hidden" is a keyword
922 921 getargs(x, 0, 0, _("hidden takes no arguments"))
923 922 hiddenrevs = repoview.filterrevs(repo, 'visible')
924 return baseset([r for r in subset if r in hiddenrevs])
923 return subset & hiddenrevs
925 924
926 925 def keyword(repo, subset, x):
927 926 """``keyword(string)``
@@ -1058,7 +1057,7 b' def obsolete(repo, subset, x):'
1058 1057 # i18n: "obsolete" is a keyword
1059 1058 getargs(x, 0, 0, _("obsolete takes no arguments"))
1060 1059 obsoletes = obsmod.getrevs(repo, 'obsolete')
1061 return baseset([r for r in subset if r in obsoletes])
1060 return subset & obsoletes
1062 1061
1063 1062 def origin(repo, subset, x):
1064 1063 """``origin([set])``
@@ -1125,8 +1124,7 b' def p1(repo, subset, x):'
1125 1124 cl = repo.changelog
1126 1125 for r in getset(repo, baseset(repo), x):
1127 1126 ps.add(cl.parentrevs(r)[0])
1128 s = subset.set()
1129 return baseset([r for r in s if r in ps])
1127 return subset & ps
1130 1128
1131 1129 def p2(repo, subset, x):
1132 1130 """``p2([set])``
@@ -1144,8 +1142,7 b' def p2(repo, subset, x):'
1144 1142 cl = repo.changelog
1145 1143 for r in getset(repo, baseset(repo), x):
1146 1144 ps.add(cl.parentrevs(r)[1])
1147 s = subset.set()
1148 return baseset([r for r in s if r in ps])
1145 return subset & ps
1149 1146
1150 1147 def parents(repo, subset, x):
1151 1148 """``parents([set])``
@@ -1153,14 +1150,13 b' def parents(repo, subset, x):'
1153 1150 """
1154 1151 if x is None:
1155 1152 ps = tuple(p.rev() for p in repo[x].parents())
1156 return baseset([r for r in subset if r in ps])
1153 return subset & ps
1157 1154
1158 1155 ps = set()
1159 1156 cl = repo.changelog
1160 1157 for r in getset(repo, baseset(repo), x):
1161 1158 ps.update(cl.parentrevs(r))
1162 s = subset.set()
1163 return baseset([r for r in s if r in ps])
1159 return subset & ps
1164 1160
1165 1161 def parentspec(repo, subset, x, n):
1166 1162 """``set^0``
@@ -1185,8 +1181,7 b' def parentspec(repo, subset, x, n):'
1185 1181 parents = cl.parentrevs(r)
1186 1182 if len(parents) > 1:
1187 1183 ps.add(parents[1])
1188 s = subset.set()
1189 return baseset([r for r in s if r in ps])
1184 return subset & ps
1190 1185
1191 1186 def present(repo, subset, x):
1192 1187 """``present(set)``
@@ -1531,7 +1526,7 b' def tag(repo, subset, x):'
1531 1526 s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)])
1532 1527 else:
1533 1528 s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip'])
1534 return baseset([r for r in subset if r in s])
1529 return subset & s
1535 1530
1536 1531 def tagged(repo, subset, x):
1537 1532 return tag(repo, subset, x)
@@ -1543,7 +1538,7 b' def unstable(repo, subset, x):'
1543 1538 # i18n: "unstable" is a keyword
1544 1539 getargs(x, 0, 0, _("unstable takes no arguments"))
1545 1540 unstables = obsmod.getrevs(repo, 'unstable')
1546 return baseset([r for r in subset if r in unstables])
1541 return subset & unstables
1547 1542
1548 1543
1549 1544 def user(repo, subset, x):
@@ -2074,5 +2069,11 b' class baseset(list):'
2074 2069 s = set(x)
2075 2070 return baseset(self.set() - s)
2076 2071
2072 def __and__(self, x):
2073 s = self.set()
2074 if isinstance(x, baseset):
2075 x = x.set()
2076 return baseset([y for y in s if y in x])
2077
2077 2078 # tell hggettext to extract docstrings from these functions:
2078 2079 i18nfunctions = symbols.values()
General Comments 0
You need to be logged in to leave comments. Login now