Show More
@@ -999,12 +999,20 def first(repo, subset, x): | |||||
999 | return limit(repo, subset, x) |
|
999 | return limit(repo, subset, x) | |
1000 |
|
1000 | |||
1001 | def _follow(repo, subset, x, name, followfirst=False): |
|
1001 | def _follow(repo, subset, x, name, followfirst=False): | |
1002 |
l = getargs(x, 0, |
|
1002 | l = getargs(x, 0, 2, _("%s takes no arguments or a pattern " | |
|
1003 | "and an optional revset") % name) | |||
1003 | c = repo['.'] |
|
1004 | c = repo['.'] | |
1004 | if l: |
|
1005 | if l: | |
1005 | x = getstring(l[0], _("%s expected a pattern") % name) |
|
1006 | x = getstring(l[0], _("%s expected a pattern") % name) | |
|
1007 | rev = None | |||
|
1008 | if len(l) >= 2: | |||
|
1009 | rev = getset(repo, fullreposet(repo), l[1]).last() | |||
|
1010 | if rev is None: | |||
|
1011 | raise error.RepoLookupError( | |||
|
1012 | _("%s: starting revision set cannot be empty") % name) | |||
|
1013 | c = repo[rev] | |||
1006 | matcher = matchmod.match(repo.root, repo.getcwd(), [x], |
|
1014 | matcher = matchmod.match(repo.root, repo.getcwd(), [x], | |
1007 |
ctx=repo[ |
|
1015 | ctx=repo[rev], default='path') | |
1008 |
|
1016 | |||
1009 | files = c.manifest().walk(matcher) |
|
1017 | files = c.manifest().walk(matcher) | |
1010 |
|
1018 | |||
@@ -1019,20 +1027,20 def _follow(repo, subset, x, name, follo | |||||
1019 |
|
1027 | |||
1020 | return subset & s |
|
1028 | return subset & s | |
1021 |
|
1029 | |||
1022 | @predicate('follow([pattern])', safe=True) |
|
1030 | @predicate('follow([pattern[, startrev]])', safe=True) | |
1023 | def follow(repo, subset, x): |
|
1031 | def follow(repo, subset, x): | |
1024 | """ |
|
1032 | """ | |
1025 | An alias for ``::.`` (ancestors of the working directory's first parent). |
|
1033 | An alias for ``::.`` (ancestors of the working directory's first parent). | |
1026 | If pattern is specified, the histories of files matching given |
|
1034 | If pattern is specified, the histories of files matching given | |
1027 | pattern is followed, including copies. |
|
1035 | pattern in the revision given by startrev are followed, including copies. | |
1028 | """ |
|
1036 | """ | |
1029 | return _follow(repo, subset, x, 'follow') |
|
1037 | return _follow(repo, subset, x, 'follow') | |
1030 |
|
1038 | |||
1031 | @predicate('_followfirst', safe=True) |
|
1039 | @predicate('_followfirst', safe=True) | |
1032 | def _followfirst(repo, subset, x): |
|
1040 | def _followfirst(repo, subset, x): | |
1033 | # ``followfirst([pattern])`` |
|
1041 | # ``followfirst([pattern[, startrev]])`` | |
1034 |
# Like ``follow([pattern])`` but follows only the first parent |
|
1042 | # Like ``follow([pattern[, startrev]])`` but follows only the first parent | |
1035 | # every revisions or files revisions. |
|
1043 | # of every revisions or files revisions. | |
1036 | return _follow(repo, subset, x, '_followfirst', followfirst=True) |
|
1044 | return _follow(repo, subset, x, '_followfirst', followfirst=True) | |
1037 |
|
1045 | |||
1038 | @predicate('all()', safe=True) |
|
1046 | @predicate('all()', safe=True) |
@@ -717,6 +717,19 log -r "follow('set:grep(b2)')" | |||||
717 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
717 | date: Thu Jan 01 00:00:01 1970 +0000 | |
718 | summary: b2 |
|
718 | summary: b2 | |
719 |
|
719 | |||
|
720 | log -r "follow('set:grep(b2)', 4)" | |||
|
721 | ||||
|
722 | $ hg up -qC 0 | |||
|
723 | $ hg log -r "follow('set:grep(b2)', 4)" | |||
|
724 | changeset: 4:ddb82e70d1a1 | |||
|
725 | tag: tip | |||
|
726 | parent: 0:67e992f2c4f3 | |||
|
727 | user: test | |||
|
728 | date: Thu Jan 01 00:00:01 1970 +0000 | |||
|
729 | summary: b2 | |||
|
730 | ||||
|
731 | $ hg up -qC 4 | |||
|
732 | ||||
720 | log -f -r null |
|
733 | log -f -r null | |
721 |
|
734 | |||
722 | $ hg log -f -r null |
|
735 | $ hg log -f -r null |
General Comments 0
You need to be logged in to leave comments.
Login now