shonky linux user
shonky linux user

Reputation: 6428

Mercurial find files that have not been modified since a revision

I am trying to find a list of source files that have not been modified for the past few years.

This is one aspect I am trying to measure to try to help us understand the amount of stability and change in a given project over time.

Is there any way in mercurial to identify the files that have not been modified since a given revision?

Upvotes: 2

Views: 54

Answers (2)

peak
peak

Reputation: 116967

There is some ambiguity in the question, but it can probably be answered using the status (st) command. For example, to obtain a listing based on a comparison of the files at revision R with those in the pwd, you could run:

hg st --rev R -cn

The -c option is equivalent to "--clean" (meaning in effect "no change").

To compare the files at revision R with those in the most recent commit:

hg st --rev R:-1 -cn

There are many ways to specify "R", e.g. 0 for the initial commit.

Upvotes: 2

shonky linux user
shonky linux user

Reputation: 6428

Posting my own answer.

I cloned the repository twice into new directories.

Then updated one to the current version and one to the original baseline revsion

hg update <rev>

Then used the diff command to find files that were identical (excluding whitespace changes)

 diff -sqrbwB original current | grep "identical"

The diff flags are as follows:

-s reports identical files (facilitating the grep for "identical")
-q brief report (don't need a detailed report of differences)
-r recursively follow directories
-b ignore space changes
-w ignore all space
-B ignore Blank lines

Not sure if -b -w and -B are all necessary but it worked and output a list of files that have not chaged.

Upvotes: 0

Related Questions