405 raise util.Abort(_("no bookmarks exist that match '%s'") |
405 raise util.Abort(_("no bookmarks exist that match '%s'") |
406 % pattern) |
406 % pattern) |
407 bmrevs = set() |
407 bmrevs = set() |
408 for bmrev in matchrevs: |
408 for bmrev in matchrevs: |
409 bmrevs.add(repo[bmrev].rev()) |
409 bmrevs.add(repo[bmrev].rev()) |
410 s = subset.set() |
410 return subset & bmrevs |
411 return baseset([r for r in s if r in bmrevs]) |
|
412 |
411 |
413 bms = set([repo[r].rev() |
412 bms = set([repo[r].rev() |
414 for r in repo._bookmarks.values()]) |
413 for r in repo._bookmarks.values()]) |
415 s = subset.set() |
414 s = subset.set() |
416 return baseset([r for r in s if r in bms]) |
415 return baseset([r for r in s if r in bms]) |
453 Only non-public and non-obsolete changesets can be `bumped`. |
452 Only non-public and non-obsolete changesets can be `bumped`. |
454 """ |
453 """ |
455 # i18n: "bumped" is a keyword |
454 # i18n: "bumped" is a keyword |
456 getargs(x, 0, 0, _("bumped takes no arguments")) |
455 getargs(x, 0, 0, _("bumped takes no arguments")) |
457 bumped = obsmod.getrevs(repo, 'bumped') |
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 def bundle(repo, subset, x): |
459 def bundle(repo, subset, x): |
461 """``bundle()`` |
460 """``bundle()`` |
462 Changesets in the bundle. |
461 Changesets in the bundle. |
463 |
462 |
465 |
464 |
466 try: |
465 try: |
467 bundlerevs = repo.changelog.bundlerevs |
466 bundlerevs = repo.changelog.bundlerevs |
468 except AttributeError: |
467 except AttributeError: |
469 raise util.Abort(_("no bundle provided - specify with -R")) |
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 def checkstatus(repo, subset, pat, field): |
471 def checkstatus(repo, subset, pat, field): |
473 m = None |
472 m = None |
474 s = [] |
473 s = [] |
475 hasset = matchmod.patkind(pat) == 'set' |
474 hasset = matchmod.patkind(pat) == 'set' |
518 """``children(set)`` |
517 """``children(set)`` |
519 Child changesets of changesets in set. |
518 Child changesets of changesets in set. |
520 """ |
519 """ |
521 s = getset(repo, baseset(repo), x).set() |
520 s = getset(repo, baseset(repo), x).set() |
522 cs = _children(repo, subset, s) |
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 def closed(repo, subset, x): |
524 def closed(repo, subset, x): |
526 """``closed()`` |
525 """``closed()`` |
527 Changeset is closed. |
526 Changeset is closed. |
528 """ |
527 """ |
688 Obsolete changesets with obsolete descendants only. |
687 Obsolete changesets with obsolete descendants only. |
689 """ |
688 """ |
690 # i18n: "extinct" is a keyword |
689 # i18n: "extinct" is a keyword |
691 getargs(x, 0, 0, _("extinct takes no arguments")) |
690 getargs(x, 0, 0, _("extinct takes no arguments")) |
692 extincts = obsmod.getrevs(repo, 'extinct') |
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 def extra(repo, subset, x): |
694 def extra(repo, subset, x): |
696 """``extra(label, [value])`` |
695 """``extra(label, [value])`` |
697 Changesets with the given label in the extra metadata, with the given |
696 Changesets with the given label in the extra metadata, with the given |
698 optional value. |
697 optional value. |
919 Hidden changesets. |
918 Hidden changesets. |
920 """ |
919 """ |
921 # i18n: "hidden" is a keyword |
920 # i18n: "hidden" is a keyword |
922 getargs(x, 0, 0, _("hidden takes no arguments")) |
921 getargs(x, 0, 0, _("hidden takes no arguments")) |
923 hiddenrevs = repoview.filterrevs(repo, 'visible') |
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 def keyword(repo, subset, x): |
925 def keyword(repo, subset, x): |
927 """``keyword(string)`` |
926 """``keyword(string)`` |
928 Search commit message, user name, and names of changed files for |
927 Search commit message, user name, and names of changed files for |
929 string. The match is case-insensitive. |
928 string. The match is case-insensitive. |
1056 """``obsolete()`` |
1055 """``obsolete()`` |
1057 Mutable changeset with a newer version.""" |
1056 Mutable changeset with a newer version.""" |
1058 # i18n: "obsolete" is a keyword |
1057 # i18n: "obsolete" is a keyword |
1059 getargs(x, 0, 0, _("obsolete takes no arguments")) |
1058 getargs(x, 0, 0, _("obsolete takes no arguments")) |
1060 obsoletes = obsmod.getrevs(repo, 'obsolete') |
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 def origin(repo, subset, x): |
1062 def origin(repo, subset, x): |
1064 """``origin([set])`` |
1063 """``origin([set])`` |
1065 Changesets that were specified as a source for the grafts, transplants or |
1064 Changesets that were specified as a source for the grafts, transplants or |
1066 rebases that created the given revisions. Omitting the optional set is the |
1065 rebases that created the given revisions. Omitting the optional set is the |
1123 |
1122 |
1124 ps = set() |
1123 ps = set() |
1125 cl = repo.changelog |
1124 cl = repo.changelog |
1126 for r in getset(repo, baseset(repo), x): |
1125 for r in getset(repo, baseset(repo), x): |
1127 ps.add(cl.parentrevs(r)[0]) |
1126 ps.add(cl.parentrevs(r)[0]) |
1128 s = subset.set() |
1127 return subset & ps |
1129 return baseset([r for r in s if r in ps]) |
|
1130 |
1128 |
1131 def p2(repo, subset, x): |
1129 def p2(repo, subset, x): |
1132 """``p2([set])`` |
1130 """``p2([set])`` |
1133 Second parent of changesets in set, or the working directory. |
1131 Second parent of changesets in set, or the working directory. |
1134 """ |
1132 """ |
1142 |
1140 |
1143 ps = set() |
1141 ps = set() |
1144 cl = repo.changelog |
1142 cl = repo.changelog |
1145 for r in getset(repo, baseset(repo), x): |
1143 for r in getset(repo, baseset(repo), x): |
1146 ps.add(cl.parentrevs(r)[1]) |
1144 ps.add(cl.parentrevs(r)[1]) |
1147 s = subset.set() |
1145 return subset & ps |
1148 return baseset([r for r in s if r in ps]) |
|
1149 |
1146 |
1150 def parents(repo, subset, x): |
1147 def parents(repo, subset, x): |
1151 """``parents([set])`` |
1148 """``parents([set])`` |
1152 The set of all parents for all changesets in set, or the working directory. |
1149 The set of all parents for all changesets in set, or the working directory. |
1153 """ |
1150 """ |
1154 if x is None: |
1151 if x is None: |
1155 ps = tuple(p.rev() for p in repo[x].parents()) |
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 ps = set() |
1155 ps = set() |
1159 cl = repo.changelog |
1156 cl = repo.changelog |
1160 for r in getset(repo, baseset(repo), x): |
1157 for r in getset(repo, baseset(repo), x): |
1161 ps.update(cl.parentrevs(r)) |
1158 ps.update(cl.parentrevs(r)) |
1162 s = subset.set() |
1159 return subset & ps |
1163 return baseset([r for r in s if r in ps]) |
|
1164 |
1160 |
1165 def parentspec(repo, subset, x, n): |
1161 def parentspec(repo, subset, x, n): |
1166 """``set^0`` |
1162 """``set^0`` |
1167 The set. |
1163 The set. |
1168 ``set^1`` (or ``set^``), ``set^2`` |
1164 ``set^1`` (or ``set^``), ``set^2`` |
1183 ps.add(cl.parentrevs(r)[0]) |
1179 ps.add(cl.parentrevs(r)[0]) |
1184 elif n == 2: |
1180 elif n == 2: |
1185 parents = cl.parentrevs(r) |
1181 parents = cl.parentrevs(r) |
1186 if len(parents) > 1: |
1182 if len(parents) > 1: |
1187 ps.add(parents[1]) |
1183 ps.add(parents[1]) |
1188 s = subset.set() |
1184 return subset & ps |
1189 return baseset([r for r in s if r in ps]) |
|
1190 |
1185 |
1191 def present(repo, subset, x): |
1186 def present(repo, subset, x): |
1192 """``present(set)`` |
1187 """``present(set)`` |
1193 An empty set, if any revision in set isn't found; otherwise, |
1188 An empty set, if any revision in set isn't found; otherwise, |
1194 all revisions in set. |
1189 all revisions in set. |
1529 s = set([repo[tn].rev()]) |
1524 s = set([repo[tn].rev()]) |
1530 else: |
1525 else: |
1531 s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)]) |
1526 s = set([cl.rev(n) for t, n in repo.tagslist() if matcher(t)]) |
1532 else: |
1527 else: |
1533 s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip']) |
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 def tagged(repo, subset, x): |
1531 def tagged(repo, subset, x): |
1537 return tag(repo, subset, x) |
1532 return tag(repo, subset, x) |
1538 |
1533 |
1539 def unstable(repo, subset, x): |
1534 def unstable(repo, subset, x): |
1541 Non-obsolete changesets with obsolete ancestors. |
1536 Non-obsolete changesets with obsolete ancestors. |
1542 """ |
1537 """ |
1543 # i18n: "unstable" is a keyword |
1538 # i18n: "unstable" is a keyword |
1544 getargs(x, 0, 0, _("unstable takes no arguments")) |
1539 getargs(x, 0, 0, _("unstable takes no arguments")) |
1545 unstables = obsmod.getrevs(repo, 'unstable') |
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 def user(repo, subset, x): |
1544 def user(repo, subset, x): |
1550 """``user(string)`` |
1545 """``user(string)`` |
1551 User name contains string. The match is case-insensitive. |
1546 User name contains string. The match is case-insensitive. |
2072 s = x.set() |
2067 s = x.set() |
2073 else: |
2068 else: |
2074 s = set(x) |
2069 s = set(x) |
2075 return baseset(self.set() - s) |
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 # tell hggettext to extract docstrings from these functions: |
2078 # tell hggettext to extract docstrings from these functions: |
2078 i18nfunctions = symbols.values() |
2079 i18nfunctions = symbols.values() |