Show More
@@ -9,6 +9,7 b' import re' | |||||
9 | import parser, util, error, discovery, hbisect, phases |
|
9 | import parser, util, error, discovery, hbisect, phases | |
10 | import node |
|
10 | import node | |
11 | import match as matchmod |
|
11 | import match as matchmod | |
|
12 | import ancestor as ancestormod | |||
12 | from i18n import _ |
|
13 | from i18n import _ | |
13 | import encoding |
|
14 | import encoding | |
14 | import obsolete as obsmod |
|
15 | import obsolete as obsmod | |
@@ -351,6 +352,26 b' def author(repo, subset, x):' | |||||
351 | kind, pattern, matcher = _substringmatcher(n) |
|
352 | kind, pattern, matcher = _substringmatcher(n) | |
352 | return subset.filter(lambda x: matcher(encoding.lower(repo[x].user()))) |
|
353 | return subset.filter(lambda x: matcher(encoding.lower(repo[x].user()))) | |
353 |
|
354 | |||
|
355 | def only(repo, subset, x): | |||
|
356 | """``only(set, [set])`` | |||
|
357 | Changesets that are ancestors of the first set that are not ancestors | |||
|
358 | of any other head in the repo. If a second set is specified, the result | |||
|
359 | is ancestors of the first set that are not ancestors of the second set | |||
|
360 | (i.e. ::<set1> - ::<set2>). | |||
|
361 | """ | |||
|
362 | cl = repo.changelog | |||
|
363 | args = getargs(x, 1, 2, _('only takes one or two arguments')) | |||
|
364 | include = getset(repo, spanset(repo), args[0]).set() | |||
|
365 | if len(args) == 1: | |||
|
366 | descendants = set(_revdescendants(repo, include, False)) | |||
|
367 | exclude = [rev for rev in cl.headrevs() | |||
|
368 | if not rev in descendants and not rev in include] | |||
|
369 | else: | |||
|
370 | exclude = getset(repo, spanset(repo), args[1]) | |||
|
371 | ||||
|
372 | results = set(ancestormod.missingancestors(include, exclude, cl.parentrevs)) | |||
|
373 | return lazyset(subset, lambda x: x in results) | |||
|
374 | ||||
354 | def bisect(repo, subset, x): |
|
375 | def bisect(repo, subset, x): | |
355 | """``bisect(string)`` |
|
376 | """``bisect(string)`` | |
356 | Changesets marked in the specified bisect status: |
|
377 | Changesets marked in the specified bisect status: | |
@@ -1606,6 +1627,7 b' symbols = {' | |||||
1606 | "ancestors": ancestors, |
|
1627 | "ancestors": ancestors, | |
1607 | "_firstancestors": _firstancestors, |
|
1628 | "_firstancestors": _firstancestors, | |
1608 | "author": author, |
|
1629 | "author": author, | |
|
1630 | "only": only, | |||
1609 | "bisect": bisect, |
|
1631 | "bisect": bisect, | |
1610 | "bisected": bisected, |
|
1632 | "bisected": bisected, | |
1611 | "bookmark": bookmark, |
|
1633 | "bookmark": bookmark, |
@@ -367,6 +367,22 b' ancestor can accept 0 or more arguments' | |||||
367 | 4 |
|
367 | 4 | |
368 | $ log 'id(5)' |
|
368 | $ log 'id(5)' | |
369 | 2 |
|
369 | 2 | |
|
370 | $ log 'only(9)' | |||
|
371 | 8 | |||
|
372 | 9 | |||
|
373 | $ log 'only(8)' | |||
|
374 | 8 | |||
|
375 | $ log 'only(9, 5)' | |||
|
376 | 2 | |||
|
377 | 4 | |||
|
378 | 8 | |||
|
379 | 9 | |||
|
380 | $ log 'only(7 + 9, 5 + 2)' | |||
|
381 | 4 | |||
|
382 | 6 | |||
|
383 | 7 | |||
|
384 | 8 | |||
|
385 | 9 | |||
370 | $ log 'outgoing()' |
|
386 | $ log 'outgoing()' | |
371 | 8 |
|
387 | 8 | |
372 | 9 |
|
388 | 9 |
General Comments 0
You need to be logged in to leave comments.
Login now