Smash
Smash

Reputation: 3802

Mercurial - diff command with specific string

When comparing two revisions, I would like to output only the lines containing a specific string:

hg diff -r 1:4 "world"

How can I achieve this ?

For example, searching the following file:

File @ rev 1:

Hello

File @ rev 2:

Hello world

File @ rev 3:

Hello you

File @ rev 4

Hello me

The output would be

-r2 + Hello world
-r3 - Hello world

Upvotes: 0

Views: 54

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97365

Without revision-ranges it will be hg grep (with slightly different output by default)

To get it to print every revision that contains a change in match status ("-" for a match that becomes a non-match, or "+" for a non-match that becomes a match), use the --diff flag

Upvotes: 1

Related Questions