Search code examples
android-studiomercurialeol

hg diff ignore ^M


I am using Android Studio 2.2.3 & Mercurial Distributed SCM (version 4.0.1), running on MacOS Sierra 10.12.3.

I am using Hg command base client. hg diff shows:

enter image description here

Here is my ~/.hgrc

 [extensions]
 purge=
 color =
 pager =

 [pager]
 pager = LESS='FRSXQ' less
 quiet = True
 attend = outgoing,incoming,diff,status,log,qdiff,blame,annotate,pdiff,glog

Any config I should add to avoid showing ^M in diff? In Android Studio or Mercurial config? Thanks.


Solution

  • The answer depends a bit on what you want:

    a) Is it only that you do not want to see whitspace / eol character changes so that you can better review a diff? Then use the appropriate flag to the diff command: hg diff -b shows the diff while ignoreing whitespace changes including EOL.

    b) If you generally have that problem and want to have some repository-side aid in messing with the EOL characters: make use of the EOL extension. However, the much more advisable approach is to use properly configured editors and maybe repository hook which rejects files with the wrong EOL characters.