JCF
JCF

Reputation: 368

Mercurial - log first revisions of file

I am trying to retrieve the first five revisions of a file for a specific branch using Mercurial, but the documentation that I have could find only described how to show the last revisions, the branch has a lot of revisions, so going down until the beginning it is really annoying and I have no UI, it is a server environment running Linux.

Upvotes: 1

Views: 39

Answers (1)

Reimer Behrends
Reimer Behrends

Reputation: 8740

This is most easily done using revsets (see hg help revsets). In your case, something like the following should work:

hg log -r 'first(file("relative/path/to/file"),5)'

The file() revset will select all revisions that affect files matching the glob pattern given as the argument (in our case, just one specific file); the first(..., 5) revset applied to the result will then select the first five revisions out of those.

Upvotes: 2

Related Questions