Bug 2870 - Exception importing a malformed patch file.
Summary: Exception importing a malformed patch file.
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-27 16:07 UTC by John Peberdy
Modified: 2012-07-29 15:15 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments
(34 bytes, application/octet-stream)
2011-06-27 17:30 UTC, John Peberdy
Details
(34 bytes, application/octet-stream)
2011-06-27 17:32 UTC, John Peberdy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Peberdy 2011-06-27 16:07 UTC
Error importing a malformed patch file.
Expected: User friendly error message
Encountered importing in MercurialEclipse via clipboard. Presumably Windows
clipboard broke the patch in some way.


 applying C:\Users\user\AppData\Local\Temp\mercurial_2097131732089014765.patch
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
** Mercurial Distributed SCM (version 1.8.4)
** Extensions loaded: purge, mq, transplant, rebase, eol, fetch, graphlog,
convert, onsub
Traceback (most recent call last):
  File "hg", line 38, in <module>
  File "mercurial\dispatch.pyc", line 16, in run
  File "mercurial\dispatch.pyc", line 36, in dispatch
  File "mercurial\dispatch.pyc", line 58, in _runcatch
  File "mercurial\dispatch.pyc", line 601, in _dispatch
  File "mercurial\dispatch.pyc", line 406, in runcommand
  File "mercurial\dispatch.pyc", line 655, in _runcommand
  File "mercurial\dispatch.pyc", line 609, in checkargs
  File "mercurial\dispatch.pyc", line 598, in <lambda>
  File "mercurial\util.pyc", line 433, in check
  File "mercurial\extensions.pyc", line 133, in wrap
  File "mercurial\util.pyc", line 433, in check
  File "hgext\mq.pyc", line 3050, in mqcommand
  File "mercurial\util.pyc", line 433, in check
  File "mercurial\extensions.pyc", line 133, in wrap
  File "mercurial\util.pyc", line 433, in check
  File "hgext\mq.pyc", line 3022, in mqimport
  File "mercurial\util.pyc", line 433, in check
  File "mercurial\commands.pyc", line 2477, in import_
  File "mercurial\commands.pyc", line 2431, in tryone
  File "mercurial\patch.pyc", line 1251, in patch
  File "mercurial\patch.pyc", line 1223, in internalpatch
  File "mercurial\patch.pyc", line 1108, in applydiff
  File "mercurial\patch.pyc", line 1125, in _applydiff
  File "mercurial\patch.pyc", line 1032, in iterhunks
KeyError: 'etc/config/teee/ssl.keystore\r'. Command line:
D:\work\ws\enterprise:hg -y import --
C:\Users\user\AppData\Local\Temp\mercurial_2097131732089014765.patch, error
code: 255
Comment 1 Matt Mackall 2011-06-27 16:12 UTC
We need an example.
Comment 2 John Peberdy 2011-06-27 17:30 UTC
It looks like it's not related to the clipboard directly, rather that
Outlook changes newlines to CRLF when copying. Attached is the patch as
Mercurial received it (different patch, same traceback). 

It might only occur for imports of binary files. Copying from Outlook works
fine with most patches. 

 applying
C:\Users\john.peberdy\AppData\Local\Temp\mercurial_1915035238540490516.patch
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
** Mercurial Distributed SCM (version 1.8.4)
** Extensions loaded: purge, mq, transplant, rebase, eol, fetch, graphlog,
convert, onsub
Traceback (most recent call last):
  File "hg", line 38, in <module>
  File "mercurial\dispatch.pyc", line 16, in run
  File "mercurial\dispatch.pyc", line 36, in dispatch
  File "mercurial\dispatch.pyc", line 58, in _runcatch
  File "mercurial\dispatch.pyc", line 601, in _dispatch
  File "mercurial\dispatch.pyc", line 406, in runcommand
  File "mercurial\dispatch.pyc", line 655, in _runcommand
  File "mercurial\dispatch.pyc", line 609, in checkargs
  File "mercurial\dispatch.pyc", line 598, in <lambda>
  File "mercurial\util.pyc", line 433, in check
  File "mercurial\extensions.pyc", line 133, in wrap
  File "mercurial\util.pyc", line 433, in check
  File "hgext\mq.pyc", line 3050, in mqcommand
  File "mercurial\util.pyc", line 433, in check
  File "mercurial\extensions.pyc", line 133, in wrap
  File "mercurial\util.pyc", line 433, in check
  File "hgext\mq.pyc", line 3022, in mqimport
  File "mercurial\util.pyc", line 433, in check
  File "mercurial\commands.pyc", line 2477, in import_
  File "mercurial\commands.pyc", line 2431, in tryone
  File "mercurial\patch.pyc", line 1251, in patch
  File "mercurial\patch.pyc", line 1223, in internalpatch
  File "mercurial\patch.pyc", line 1108, in applydiff
  File "mercurial\patch.pyc", line 1125, in _applydiff
  File "mercurial\patch.pyc", line 1032, in iterhunks
KeyError: 'New Microsoft Office Word Document.docx\r'. Command line:
D:\work\runtime-New_configuration\enterprise:hg -y import --no-commit --
C:\Users\john.peberdy\AppData\Local\Temp\mercurial_1915035238540490516.patch, error
code: 255
Comment 3 John Peberdy 2011-06-27 17:32 UTC
Original patch for reference
Comment 4 HG Bot 2012-04-27 12:00 UTC
Fixed by http://selenic.com/repo/hg/rev/ed6a74312176
Patrick Mezard <patrick@mezard.eu>
patch: be more tolerant with EOLs in binary diffs (issue2870)

(please test the fix)
Comment 5 Bugzilla 2012-05-12 09:21 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:21 EDT  ---

This bug was previously known as _bug_ 2870 at http://mercurial.selenic.com/bts/issue2870
Imported an attachment (id=1558)
Imported an attachment (id=1559)

Bug Status was UNCONFIRMED but everconfirmed was true
   Setting status to CONFIRMED