hg diff --follow ?

Scott Palmer swpalmer at gmail.com
Fri Aug 7 21:37:03 UTC 2015


> On Aug 7, 2015, at 5:12 PM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
> 
> 
> 
>> On 08/07/2015 08:17 AM, Scott Palmer wrote:
>> 
>>> 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.
> 
> 
> You should upgrade your config to include:
> 
> [diff]
> git=True

Yes, thanks. After it was pointed out that the git option was what I wanted, I dived a bit deeper into the docs and did exactly that. 

Scott




More information about the Mercurial mailing list