[Bug 4042] New: hg import corrupts files with a trailing CR

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Mon Sep 23 20:08:20 CDT 2013


http://bz.selenic.com/show_bug.cgi?id=4042

          Priority: normal
            Bug ID: 4042
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: hg import corrupts files with a trailing CR
          Severity: bug
    Classification: Unclassified
                OS: Linux
          Reporter: mercurial at achurch.org
          Hardware: PC
            Status: UNCONFIRMED
           Version: unspecified
         Component: Mercurial
           Product: Mercurial

If a patch creates a file that has a single trailing CR (\r) with no LF (\n) on
the last line, hg import strips the \r from the last line, resulting in a file
which does not match the original.

$ hg init repo1
$ echo -n $'test\r' >repo1/test
$ hg -R repo1 add
adding repo1/test
$ hg -R repo1 commit -m.
$ hg init repo2
$ hg -R repo1 export tip | LANG= ./hg -R repo2 import --exact -
applying patch from stdin
transaction abort!
rollback completed
abort: patch is damaged or loses information
$ stat -c"%s %n" repo?/test
5 repo1/test
4 repo2/test

Tested at hg revision cccc44304b2c17fb61af747c35b2a31b4a113151.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list