tags:

views:

36

answers:

1

In Mercurial it's possible to hg status only the modified/added/removed files by doing:

hg st -m
hg st -a
hg st -r

Is it possible to obtain the same behaviour for the diff command? From the man page, it seems not.

+5  A: 

One option would be to use something like this:

hg status -mar --no-status | xargs hg diff

The --no-status flag insures that just the file name is sent to STDOUT.

Tim Henigan
That won't work if you (wrongly!) have spaces in your files names. Then you need to use `--print0` and `-0` in hg and xargs, respectively.
Ry4an
If the `color` option is set, then both `hg` commands must also include `--color=never`.
Tim Henigan
Thank you. I've created aliases for these commands and I'm now happy. It's a pity `hg diff -m` is not available, though.
Roberto Aloi