Show More
@@ -9,6 +9,7 b' import re' | |||
|
9 | 9 | import parser, util, error, discovery, hbisect, phases |
|
10 | 10 | import node |
|
11 | 11 | import match as matchmod |
|
12 | import ancestor as ancestormod | |
|
12 | 13 | from i18n import _ |
|
13 | 14 | import encoding |
|
14 | 15 | import obsolete as obsmod |
@@ -351,6 +352,26 b' def author(repo, subset, x):' | |||
|
351 | 352 | kind, pattern, matcher = _substringmatcher(n) |
|
352 | 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 | 375 | def bisect(repo, subset, x): |
|
355 | 376 | """``bisect(string)`` |
|
356 | 377 | Changesets marked in the specified bisect status: |
@@ -1606,6 +1627,7 b' symbols = {' | |||
|
1606 | 1627 | "ancestors": ancestors, |
|
1607 | 1628 | "_firstancestors": _firstancestors, |
|
1608 | 1629 | "author": author, |
|
1630 | "only": only, | |
|
1609 | 1631 | "bisect": bisect, |
|
1610 | 1632 | "bisected": bisected, |
|
1611 | 1633 | "bookmark": bookmark, |
@@ -367,6 +367,22 b' ancestor can accept 0 or more arguments' | |||
|
367 | 367 | 4 |
|
368 | 368 | $ log 'id(5)' |
|
369 | 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 | 386 | $ log 'outgoing()' |
|
371 | 387 | 8 |
|
372 | 388 | 9 |
General Comments 0
You need to be logged in to leave comments.
Login now