comparison tests/test-import-bypass.t @ 48411:6a454e7053a1

errors: return more detailed errors when failing to parse or apply patch This patch adds subclasses of `PatchError` so we can distinguish between failure to parse a patch from failure to apply it. It updates the callers to raise either `InputError` or `StateError` depending on which type of error occurred. Differential Revision: https://phab.mercurial-scm.org/D11824
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 19 Nov 2021 12:57:53 -0800
parents 8d72e29ad1e0
children
comparison
equal deleted inserted replaced
48410:7e6488aa1261 48411:6a454e7053a1
41 $ hg import --bypass ../test.diff 41 $ hg import --bypass ../test.diff
42 applying ../test.diff 42 applying ../test.diff
43 unable to find 'a' for patching 43 unable to find 'a' for patching
44 (use '--prefix' to apply patch relative to the current directory) 44 (use '--prefix' to apply patch relative to the current directory)
45 abort: patch failed to apply 45 abort: patch failed to apply
46 [255] 46 [20]
47 $ hg st 47 $ hg st
48 $ shortlog 48 $ shortlog
49 o 1:4e322f7ce8e3 test 0 0 - foo - changea 49 o 1:4e322f7ce8e3 test 0 0 - foo - changea
50 | 50 |
51 o 0:07f494440405 test 0 0 - default - adda 51 o 0:07f494440405 test 0 0 - default - adda
232 $ HGEDITOR=cat hg import -m 'should fail because of eol' --edit --bypass ../test.diff 232 $ HGEDITOR=cat hg import -m 'should fail because of eol' --edit --bypass ../test.diff
233 applying ../test.diff 233 applying ../test.diff
234 patching file a 234 patching file a
235 Hunk #1 FAILED at 0 235 Hunk #1 FAILED at 0
236 abort: patch failed to apply 236 abort: patch failed to apply
237 [255] 237 [20]
238 $ hg --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff 238 $ hg --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff
239 applying ../test.diff 239 applying ../test.diff
240 $ shortlog 240 $ shortlog
241 o 3:c606edafba99 test 0 0 - default - test patch.eol 241 o 3:c606edafba99 test 0 0 - default - test patch.eol
242 | 242 |