Show More
@@ -97,6 +97,7 b' These are the supported infix operators:' | |||
|
97 | 97 | |
|
98 | 98 | ``x~n`` |
|
99 | 99 | The nth first ancestor of x; ``x~0`` is x; ``x~3`` is ``x^^^``. |
|
100 | For n < 0, the nth unambiguous descendent of x. | |
|
100 | 101 | |
|
101 | 102 | ``x ## y`` |
|
102 | 103 | Concatenate strings and identifiers into one string. |
@@ -379,12 +379,33 b' def _firstancestors(repo, subset, x):' | |||
|
379 | 379 | # Like ``ancestors(set)`` but follows only the first parents. |
|
380 | 380 | return _ancestors(repo, subset, x, followfirst=True) |
|
381 | 381 | |
|
382 | def _childrenspec(repo, subset, x, n, order): | |
|
383 | """Changesets that are the Nth child of a changeset | |
|
384 | in set. | |
|
385 | """ | |
|
386 | cs = set() | |
|
387 | for r in getset(repo, fullreposet(repo), x): | |
|
388 | for i in range(n): | |
|
389 | c = repo[r].children() | |
|
390 | if len(c) == 0: | |
|
391 | break | |
|
392 | if len(c) > 1: | |
|
393 | raise error.RepoLookupError( | |
|
394 | _("revision in set has more than one child")) | |
|
395 | r = c[0] | |
|
396 | else: | |
|
397 | cs.add(r) | |
|
398 | return subset & cs | |
|
399 | ||
|
382 | 400 | def ancestorspec(repo, subset, x, n, order): |
|
383 | 401 | """``set~n`` |
|
384 | 402 | Changesets that are the Nth ancestor (first parents only) of a changeset |
|
385 | 403 | in set. |
|
386 | 404 | """ |
|
387 | 405 | n = getinteger(n, _("~ expects a number")) |
|
406 | if n < 0: | |
|
407 | # children lookup | |
|
408 | return _childrenspec(repo, subset, x, -n, order) | |
|
388 | 409 | ps = set() |
|
389 | 410 | cl = repo.changelog |
|
390 | 411 | for r in getset(repo, fullreposet(repo), x): |
@@ -2975,6 +2975,14 b' parentrevspec' | |||
|
2975 | 2975 | $ log 'merge()^^^' |
|
2976 | 2976 | 1 |
|
2977 | 2977 | |
|
2978 | $ log '(merge() | 0)~-1' | |
|
2979 | 7 | |
|
2980 | 1 | |
|
2981 | $ log 'merge()~-1' | |
|
2982 | 7 | |
|
2983 | $ log 'tip~-1' | |
|
2984 | $ log '(tip | merge())~-1' | |
|
2985 | 7 | |
|
2978 | 2986 | $ log 'merge()~0' |
|
2979 | 2987 | 6 |
|
2980 | 2988 | $ log 'merge()~1' |
@@ -2995,6 +3003,10 b' parentrevspec' | |||
|
2995 | 3003 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
2996 | 3004 | [255] |
|
2997 | 3005 | |
|
3006 | $ log 'branchpoint()~-1' | |
|
3007 | abort: revision in set has more than one child! | |
|
3008 | [255] | |
|
3009 | ||
|
2998 | 3010 | Bogus function gets suggestions |
|
2999 | 3011 | $ log 'add()' |
|
3000 | 3012 | hg: parse error: unknown identifier: add |
General Comments 0
You need to be logged in to leave comments.
Login now