mirror of
https://github.com/facebook/sapling.git
synced 2024-12-28 15:44:27 +03:00
checkmessagehook: make error message more obvious
Summary: This hopefully makes it more obvious so it looks less like an hg crash. Reviewed By: kulshrax Differential Revision: D23509569 fbshipit-source-id: 7174780bc7e9841e3f89a482280c49427b62fb74
This commit is contained in:
parent
4131dcf012
commit
dabb68c1e5
@ -37,9 +37,13 @@ def checkcommitmessage(ui, repo, **kwargs):
|
||||
break
|
||||
|
||||
if badlines:
|
||||
ui.warn(_("non-printable characters in commit message\n"))
|
||||
ui.warn(_("+-------------------------------------------------------------\n"))
|
||||
ui.warn(_("| Non-printable characters in commit message are not allowed.\n"))
|
||||
ui.warn(_("| Edit your commit message to fix this issue.\n"))
|
||||
ui.warn(_("| The problematic commit message can be found at:\n"))
|
||||
for num, l in badlines:
|
||||
ui.warn(_("Line {}: {!r}\n".format(num, l)))
|
||||
ui.warn(_("| Line {}: {!r}\n".format(num, l)))
|
||||
ui.warn(_("+-------------------------------------------------------------\n"))
|
||||
|
||||
# False means success
|
||||
return bool(badlines)
|
||||
|
@ -20,9 +20,13 @@ sh % "cd repo"
|
||||
sh % "touch a"
|
||||
sh % 'hg commit -A -l "$TESTDIR/ctrlchar-msg.txt"' == r"""
|
||||
adding a
|
||||
non-printable characters in commit message
|
||||
Line 5: 'This has a sneaky ctrl-A: \x01'
|
||||
Line 6: 'And this has esc: \x1b'
|
||||
+-------------------------------------------------------------
|
||||
| Non-printable characters in commit message are not allowed.
|
||||
| Edit your commit message to fix this issue.
|
||||
| The problematic commit message can be found at:
|
||||
| Line 5: 'This has a sneaky ctrl-A: \x01'
|
||||
| Line 6: 'And this has esc: \x1b'
|
||||
+-------------------------------------------------------------
|
||||
abort: pretxncommit.checkmessage hook failed
|
||||
[255]"""
|
||||
sh % 'hg commit -A -l "$TESTDIR/perfectlyok-msg.txt"' == "adding a"
|
||||
|
Loading…
Reference in New Issue
Block a user