How to make `hg diff` show whitespace changes?
Noemi Millman
noemi.millman at backstage.com
Thu Jan 14 16:31:58 UTC 2016
`hg update -C` does not clear the changes. Only nuking the resource forks seems to.
> On Jan 14, 2016, at 11:04 AM, Matt Harbison <mharbison72 at gmail.com> wrote:
>
> (cc: list)
>
> On Thu, 14 Jan 2016 10:26:05 -0500, Noemi Millman <noemi.millman at backstage.com> wrote:
>
>>
>> Thanks, Matt!
>>
>> Great call about the resource forks (and a facepalm moment for me!) I can confirm that that's the problem, since changing the default app to open a file without editing the file itself adds it to the list of mysteriously changed-yet-unchanged files.
>>
>> I wonder why Mercurial recognizes resource fork changes but git doesn't?
>
> It's been a few months since I looked into it, but IIRC, the python call used to determine the file size sees both the data and resource forks. Thats going to be different from the data-fork-only size in Mercurial. So nothing you can do without submitting patches, but you should probably wait until after Feb 1 to do that. It may be too close to a code freeze now to mess around with that.
>
> I noticed it because of beyondcompare like I said, but it was "intermittent" because extdiff sometimes copies the files to a temp directory, and sometimes opens them in place. When Mercurial copies the file back to your working directory from /tmp, it ignores the resource fork that was made in /tmp/foo, so the problem doesn't happen.
>
> If you can't restore to a clean copy with 'update -C', that seems like a bug to me.
>
>> I'll have to do a bit of research to figure out how to get Mercurial to ignore them, and will post back if I can for the reference of anyone who encounters this in the future.
>>
>> cheers,
>> -Noemi
>>
>>> On Jan 13, 2016, at 10:58 PM, Matt Harbison <mharbison72 at gmail.com> wrote:
>>>
>>> On Wed, 13 Jan 2016 11:03:37 -0500, Noemi Millman <noemi.millman at backstage.com> wrote:
>>>
>>>> Thanks, Matt!
>>>>
>>>> Why would a merge show a file as changed if contents, permissions, line endings, etc. haven't changed?
>>>
>>> In addition to what Matt said (which is likely the reason for your merge issue), be aware of resource forks on OS X. Mercurial doesn't track or handle them, but if a tool adds one, status will say 'M' and diff will show nothing because the file size changes. You can see if you have them with `ls -l@`.
>>>
>>> They seem to get created with BeyondCompare on 10.6.8, but not on 10.10. I forget if `hg update -C` removes them, but I'm thinking not since I've gotten into the habit of manually removing them.
>>>
>>>>> On Jan 13, 2016, at 10:53 AM, Matt Mackall <mpm at selenic.com> wrote:
>>>>>
>>>>> On Wed, 2016-01-13 at 07:13 -0800, Noemi wrote:
>>>>>> When I run `hg status`, it shows a few files as changed, but `hg diff`
>>>>>> outputs absolutely nothing. Why might this happen other than whitespace
>>>>>> changes?
>>>>>
>>>>> Line ending, empty vs deleted, copies, renames, exec bits, merges, etc.
>>>>>
>>>>>> If it is whitespace changes, how can I make `hg diff` display
>>>>>> them? The docs explain how to ignore whitespace changes, but not how to
>>>>>> make sure they're displayed.
>>>>>
>>>>> They're displayed by default.
>>>>>
>>>>> The standard diff tool was created in 1974. Mercurial was created in 2005. So
>>>>> asking why the diff format doesn't capture all the details is a bit like asking
>>>>> why a VHS (1976) copy of a BluRay (2006) doesn't look as good.
>>>>>
>>>>> We also support the Git format with -g which will show some but not all of the
>>>>> aforementioned differences and also breaks some of the tools that work with
>>>>> standard diffs.
>>>>>
>>>>> --
>>>>> Mathematics is the supreme nostalgia of our time.
>>>>>
>>>>
>>>> _______________________________________________
>>>> Mercurial mailing list
>>>> Mercurial at selenic.com
>>>> https://selenic.com/mailman/listinfo/mercurial
More information about the Mercurial
mailing list