[Bug 6183] New: hg import fails to ignore '\ ' line due to Windows line endings

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Tue Aug 6 09:25:48 UTC 2019


https://bz.mercurial-scm.org/show_bug.cgi?id=6183

            Bug ID: 6183
           Summary: hg import fails to ignore '\ ' line due to Windows
                    line endings
           Product: Mercurial
           Version: unspecified
          Hardware: PC
                OS: Windows
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: jbvernee at xs4all.nl
                CC: mercurial-devel at mercurial-scm.org

A patch file like the following:

```
diff -r c4b6f80981fd README.md
--- a/README.md Tue Aug 06 14:37:03 2019 +0200
+++ b/README.md Tue Aug 06 14:49:23 2019 +0200
@@ -2,1 +2,1 @@
-Second Line
\ No newline at end of file
+Second Line
```

(encoding being UTF-8) fails to apply when having Windows line endings (CRLF),
giving the following error:

applying diff.patch
abort: bad hunk #1 @@ -2,1 +2,1 @@
 (2 1 1 1)

But applies correctly when using unix line endings (LF).

This happens when running `hg import diff.patch` in a Windows native shell,
using hg.exe bundled with TortoiseHG (version 5.0.2).

It seems that the `\ ` line fails to be ignored by:
[https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/patch.py#l1325] when
there are Windows line endings?

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


More information about the Mercurial-devel mailing list