Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 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 | cb4ff8ef466b |
comparison
equal
deleted
inserted
replaced
14342:c0b6a734b4f3 | 14343:9ed227f79e47 |
---|---|
392 s.add(fl.linkrev(fr)) | 392 s.add(fl.linkrev(fr)) |
393 | 393 |
394 return [r for r in subset if r in s] | 394 return [r for r in subset if r in s] |
395 | 395 |
396 def follow(repo, subset, x): | 396 def follow(repo, subset, x): |
397 """``follow([file])`` | |
398 An alias for ``::.`` (ancestors of the working copy's first parent). | |
399 If a filename is specified, the history of the given file is followed, | |
400 including copies. | |
401 """ | |
402 # i18n: "follow" is a keyword | |
403 l = getargs(x, 0, 1, _("follow takes no arguments or a filename")) | |
404 p = repo['.'].rev() | |
405 if l: | |
406 x = getstring(l[0], "follow expected a filename") | |
407 s = set(ctx.rev() for ctx in repo['.'][x].ancestors()) | |
408 else: | |
409 s = set(repo.changelog.ancestors(p)) | |
410 | |
411 s |= set([p]) | |
412 return [r for r in subset if r in s] | |
413 | |
414 def followfile(repo, subset, f): | |
397 """``follow()`` | 415 """``follow()`` |
398 An alias for ``::.`` (ancestors of the working copy's first parent). | 416 An alias for ``::.`` (ancestors of the working copy's first parent). |
399 """ | 417 """ |
400 # i18n: "follow" is a keyword | 418 # i18n: "follow" is a keyword |
401 getargs(x, 0, 0, _("follow takes no arguments")) | 419 getargs(x, 0, 0, _("follow takes no arguments")) |