Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get a list of files modified between two arbitrary changesets?

Tags:

mercurial

My only guess is something horrible like this:

# files where something has been added
hg diff -r AA -r BB|grep -- +++|cut -f1|cut -d/ -f2- >/tmp/ka

# files where something has been removed
hg diff -r AA -r BB|grep -- ---|cut -f1|cut -d/ -f2- >>/tmp/ka

# filtering out "dev/null": it appears when a file is added or removed from the repository
sort -u /tmp/ka |grep -v dev/null

What I need is the files modified between changeset AA and changeset BB. Something like hg diff -r AA -r BB but file names only, instead of a whole diff.

Maybe there's a mercurial command I didn't notice? The changesets I want to examine are not consecutive, otherwise I could have just used hg status.


NOT the modified files of a single changeset.
edit: I need to do this because I'm working with some programmers from the Bronze Age who don't understand what a .diff is, please bear with me...
like image 237
o0'. Avatar asked Mar 26 '12 15:03

o0'.


2 Answers

hg diff -r 182 -r 193 --stat

or

hg status --rev 182:193

like image 69
a sad dude Avatar answered Sep 21 '22 17:09

a sad dude


The basic command to look for when you want to know something about file status is hg status. The status command is the file name oriented command and you want to know some file names.

When you run it as

$ hg status

then it compares the working copy state with the working copy parent revision (.). But if you run it as

$ hg status --rev AA:BB

then it will show files modified between AA and BB! No need for grepping, cutting, sorting or templates.

(I've explained this before here, here, and here, please see those questions and answers for more tips.)

like image 8
Martin Geisler Avatar answered Sep 23 '22 17:09

Martin Geisler