Mercurial > hg
changeset 14343:9ed227f79e47
revset: add follow(filename) to follow a filename's history across copies
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 16 May 2011 17:02:35 -0500 |
parents | c0b6a734b4f3 |
children | e1db8a00188b |
files | mercurial/revset.py |
diffstat | 1 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Mon May 16 17:02:35 2011 -0500 +++ b/mercurial/revset.py Mon May 16 17:02:35 2011 -0500 @@ -394,6 +394,24 @@ return [r for r in subset if r in s] def follow(repo, subset, x): + """``follow([file])`` + An alias for ``::.`` (ancestors of the working copy's first parent). + If a filename is specified, the history of the given file is followed, + including copies. + """ + # i18n: "follow" is a keyword + l = getargs(x, 0, 1, _("follow takes no arguments or a filename")) + p = repo['.'].rev() + if l: + x = getstring(l[0], "follow expected a filename") + s = set(ctx.rev() for ctx in repo['.'][x].ancestors()) + else: + s = set(repo.changelog.ancestors(p)) + + s |= set([p]) + return [r for r in subset if r in s] + +def followfile(repo, subset, f): """``follow()`` An alias for ``::.`` (ancestors of the working copy's first parent). """