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
We need an example.
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
Original patch for reference
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)
--- 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