Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: How do I find the most recent revision that includes a specific file, if possible?

I have a file that's been modified recently. Rather than looking into each revision, is there an easier way to find out, in Mercurial, in which revision the file was last modified? Thanks.

Note that I am using command line in Linux.

like image 339
tamakisquare Avatar asked Nov 22 '11 00:11

tamakisquare


2 Answers

This will give you the last time a change was made to a particular file (increase 1 to N to see last N changes):

hg log -l 1 ./path/to/file

like image 59
James Avatar answered Nov 03 '22 12:11

James


The answer of Autopulated is exactly what you are looking for if you just want to have a look on the last revision for a file.

I just wanted to mention the grep command :

$ hg help grep
hg grep [OPTION]... PATTERN [FILE]...

search for a pattern in specified files and revisions
[...]

With hg grep, you can search a particular file or the whole repository at any revision or range of revision for a particular pattern.

It is the kind of command which is really helpful if you're searching for the revision in which a particular method or variable was introduced or removed for example.

like image 35
krtek Avatar answered Nov 03 '22 11:11

krtek