Mercurial > public > mercurial-scm > hg
diff mercurial/cmdutil.py @ 48364:220506bb213e
patch: add hint about mangled whitespace on bad patch
One of the most common reasons that a patch doesn't apply is because
its whitespace has been mangled (e.g. by their mail client or though
copy&paste). Let's provide a hint about that.
Differential Revision: https://phab.mercurial-scm.org/D11825
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 19 Nov 2021 09:17:30 -0800 |
parents | 6a454e7053a1 |
children | 9f1b9e128788 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Fri Nov 19 12:57:53 2021 -0800 +++ b/mercurial/cmdutil.py Fri Nov 19 09:17:30 2021 -0800 @@ -2025,7 +2025,12 @@ similarity=sim / 100.0, ) except error.PatchParseError as e: - raise error.InputError(pycompat.bytestr(e)) + raise error.InputError( + pycompat.bytestr(e), + hint=_( + b'check that whitespace in the patch has not been mangled' + ), + ) except error.PatchApplicationError as e: if not partial: raise error.StateError(pycompat.bytestr(e)) @@ -2086,7 +2091,12 @@ eolmode=None, ) except error.PatchParseError as e: - raise error.InputError(stringutil.forcebytestr(e)) + raise error.InputError( + stringutil.forcebytestr(e), + hint=_( + b'check that whitespace in the patch has not been mangled' + ), + ) except error.PatchApplicationError as e: raise error.StateError(stringutil.forcebytestr(e)) if opts.get(b'exact'):