447 If a filename is specified, the history of the given file is followed, |
447 If a filename is specified, the history of the given file is followed, |
448 including copies. |
448 including copies. |
449 """ |
449 """ |
450 # i18n: "follow" is a keyword |
450 # i18n: "follow" is a keyword |
451 l = getargs(x, 0, 1, _("follow takes no arguments or a filename")) |
451 l = getargs(x, 0, 1, _("follow takes no arguments or a filename")) |
452 p = repo['.'].rev() |
452 c = repo['.'] |
453 if l: |
453 if l: |
454 x = getstring(l[0], _("follow expected a filename")) |
454 x = getstring(l[0], _("follow expected a filename")) |
455 if x in repo['.']: |
455 if x in c: |
456 s = set(ctx.rev() for ctx in repo['.'][x].ancestors()) |
456 cx = c[x] |
|
457 s = set(ctx.rev() for ctx in cx.ancestors()) |
|
458 # include the revision responsible for the most recent version |
|
459 s.add(cx.linkrev()) |
457 else: |
460 else: |
458 return [] |
461 return [] |
459 else: |
462 else: |
460 s = set(repo.changelog.ancestors(p)) |
463 s = set(repo.changelog.ancestors(c.rev())) |
461 |
464 s.add(c.rev()) |
462 s |= set([p]) |
465 |
463 return [r for r in subset if r in s] |
466 return [r for r in subset if r in s] |
464 |
467 |
465 def getall(repo, subset, x): |
468 def getall(repo, subset, x): |
466 """``all()`` |
469 """``all()`` |
467 All changesets, the same as ``0:tip``. |
470 All changesets, the same as ``0:tip``. |