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

login
register
mail settings
Submitter mercurial-bugs@mercurial-scm.org
Date Aug. 6, 2019, 9:25 a.m.
Message ID <bug-6183-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/41176/
State Not Applicable
Headers show

Comments

mercurial-bugs@mercurial-scm.org - Aug. 6, 2019, 9:25 a.m.
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@mercurial-scm.org
          Reporter: jbvernee@xs4all.nl
                CC: mercurial-devel@mercurial-scm.org

A patch file like the following:

```
```

(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?

Patch

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