hg diff --follow ?

Scott Palmer swpalmer at gmail.com
Fri Aug 7 15:17:02 UTC 2015


> On Aug 7, 2015, at 11:12 AM, Adrian Klaver <adrian.klaver at aklaver.com> wrote:
> 
> On 08/07/2015 08:00 AM, Scott Palmer wrote:
>> If I rename a file and edit it, e.g.:
>> 
>> hg mv a.txt b.txt
>> echo “Added line” >> b.txt
>> 
>> I think it makes sense that “hg diff” would show me the edits and not treat the file as if it was really branch new.
>> 
>> Currently “hg diff” shows me something like this:
>> 
>> hg diff
>> diff -r 123456789abc a.txt
>> — a/a.txt
>> +++ /dev/null
>> -existing line
>> 
>> diff -r 123456789abc b.txt
>> --- /dev/null
>> +++ b/b.txt
>> +existing line
>> +Added line
>> 
>> 
>> But I would like to see something like this::
>> 
>> diff -r 123456789abc b.txt
>> --- a/a.txt
>> +++ b/b.txt
>>  existing line
>> +Added line
>> 
>> 
>> Would it make sense to add the same option that “log” has, “--follow” so diff can show me more useful output?
> 
> aklaver at panda:~/test/hg_test> hg diff -g
> diff --git a/a.txt b/b.txt
> rename from a.txt
> rename to b.txt
> --- a/a.txt
> +++ b/b.txt
> @@ -1,1 +1,2 @@
> existing line
> +“Added line”


Doh! Thanks,  not being a Git user, I didn’t realize the --git option did that, or that it was particularly interesting to me.  I should have just tried it.

Scott



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20150807/bc8d7f9b/attachment.asc>


More information about the Mercurial mailing list