sapling/tests/test-exitcodemask-t.py
Jun Wu a55fe385eb dispatch: change 'no repository found' message
Summary:
Change the message so it looks more like a user error, not a crash in the
software. This is motivated by some people reporting `hg rage` crash with
`abort: no repository found` messages.

Reviewed By: sfilipco

Differential Revision: D17292658

fbshipit-source-id: 9988f54f2ff8fd48949bcd35c13309c117f3afc6
2019-09-10 18:29:50 -07:00

42 lines
1.5 KiB
Python

# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
# Command line flag is effective:
sh % "hg add a --config 'ui.exitcodemask=63'" == r"""
abort: '$TESTTMP' is not inside a repository, but this command requires a repository!
(use 'cd' to go to a directory inside a repository and try again)
[63]"""
sh % "'HGPLAIN=1' hg add a --config 'ui.exitcodemask=63'" == r"""
abort: '$TESTTMP' is not inside a repository, but this command requires a repository!
(use 'cd' to go to a directory inside a repository and try again)
[63]"""
# Config files are ignored if HGPLAIN is set:
sh % "setconfig 'ui.exitcodemask=31'"
sh % "hg add a" == r"""
abort: '$TESTTMP' is not inside a repository, but this command requires a repository!
(use 'cd' to go to a directory inside a repository and try again)
[31]"""
sh % "'HGPLAIN=1' hg add a" == r"""
abort: '$TESTTMP' is not inside a repository, but this command requires a repository!
(use 'cd' to go to a directory inside a repository and try again)
[255]"""
# But HGPLAINEXCEPT can override the behavior:
sh % "'HGPLAIN=1' 'HGPLAINEXCEPT=exitcode' hg add a" == r"""
abort: '$TESTTMP' is not inside a repository, but this command requires a repository!
(use 'cd' to go to a directory inside a repository and try again)
[31]"""