[issue2703] hg diff ignores line ending format of eol extension

Paul K bugs at mercurial.selenic.com
Tue Mar 15 20:01:39 UTC 2011


New submission from Paul K <bobpaul+hgbts at gmail.com>:

Observed behavior:
With eol enabled and the working directory format does not match the
repository format, hg diff shows line endings from the perspective of the
repository, not the working directory. This means patches made with 'hg diff
> patchfile' don't apply. This might be causing an issue with the 3rd party
'hg shelve' extension that I'm seeing. 

Expected behavior:
hg diff should show the line endings for your local format based on .hgeol
settings file.

Steps to reproduce:
$ mkdir test
$ cd test
$ hg init
$ cat << 'EOL' > .hgeol
[patterns]
**.txt = native
[repository]
native = CRLF
EOL
$ cat << 'EOL' > Newfile.txt
This is
some 
text
EOL
$ hg add Newfile.txt .hgeol
$ hg commit -m "Added files"
$ cat << 'EOL' > Newfile.txt
This is
some 
new
text
EOL
$ #And now we see the problem...
$ hg diff
diff -r fa884450ab95 Newfile.txt
--- a/Newfile.txt       Tue Mar 15 14:51:03 2011 -0500
+++ b/Newfile.txt       Tue Mar 15 14:52:02 2011 -0500
@@ -1,3 +1,4 @@
 This is
 some 
+new^M
 text
$ #expected to see something like:
$ hg diff | sed 's/^M//'
diff -r fa884450ab95 Newfile.txt
--- a/Newfile.txt	Tue Mar 15 14:51:03 2011 -0500
+++ b/Newfile.txt	Tue Mar 15 14:55:46 2011 -0500
@@ -1,3 +1,4 @@
 This is
 some 
+new
 text

Diff output should match the working directory. If there's a reason to have
it match the repo, that should be supported with a flag to hg diff.

----------
messages: 15669
nosy: bobpaul
priority: bug
status: unread
title: hg diff ignores line ending format of eol extension
topic: eol

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2703>
____________________________________________________


More information about the Mercurial-devel mailing list