Mercurial > hg
annotate tests/mockblackbox.py @ 46492:7289eac777ec stable
hooks: introduce a `:run-with-plain` option for hooks
This option control if HGPLAIN should be set or not for the hooks. This is the
first step to give user some control of the HGPLAIN setting for they hooks.
Some hooks (eg: consistency checking) deserve to be run with HGPLAIN, some other
(eg: user set visual helper) might need to respect the user config and setting.
So both usage are valid and we need to restore the ability to run -without-
HGPLAIN that got lost in Mercurial 5.7.
This does not offer a way to restore the pre-5.7 behavior yet (respect whatever
HGPLAIN setting from the shell), this will be dealt with in the next changeset.
The option name is a bit verbose because implementing this highlighs the need
for another option: `:run-if-plain`. That would make it possible for some hooks
to be easily disabled if HG PLAIN is set. However such option would be a new
feature, not something introduced to mitigate a behavior change introduced in
5.7, so the `:run-if-plain` option belong to the default branch and is not part
of this series.
Differential Revision: https://phab.mercurial-scm.org/D9981
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 10 Feb 2021 23:21:21 +0100 |
parents | 2372284d9457 |
children | 6000f5b25c9b |
rev | line source |
---|---|
28943
417380aa5bbe
py3: use absolute_import in mockblackbox.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
28028
diff
changeset
|
1 from __future__ import absolute_import |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37120
diff
changeset
|
2 from mercurial.utils import procutil |
24705
0ead0a07ed9c
tests: move mock blackbox extension into own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
32412
043948c84647
devel: update blackbox to use default-date
Boris Feld <boris.feld@octobus.net>
parents:
28943
diff
changeset
|
4 # XXX: we should probably offer a devel option to do this in blackbox directly |
24705
0ead0a07ed9c
tests: move mock blackbox extension into own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 def getuser(): |
36105
f49c3ee5b02f
py3: use b'' in mockblackbox.py
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32412
diff
changeset
|
6 return b'bob' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37120
diff
changeset
|
7 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37120
diff
changeset
|
8 |
28028
ac49ecb2a897
tests: mock getpid to reduce glob usage
timeless <timeless@mozdev.org>
parents:
24705
diff
changeset
|
9 def getpid(): |
ac49ecb2a897
tests: mock getpid to reduce glob usage
timeless <timeless@mozdev.org>
parents:
24705
diff
changeset
|
10 return 5000 |
24705
0ead0a07ed9c
tests: move mock blackbox extension into own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37120
diff
changeset
|
12 |
24705
0ead0a07ed9c
tests: move mock blackbox extension into own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 # mock the date and user apis so the output is always the same |
0ead0a07ed9c
tests: move mock blackbox extension into own file
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 def uisetup(ui): |
37120
a8a902d7176e
procutil: bulk-replace function calls to point to new module
Yuya Nishihara <yuya@tcha.org>
parents:
36105
diff
changeset
|
15 procutil.getuser = getuser |
a8a902d7176e
procutil: bulk-replace function calls to point to new module
Yuya Nishihara <yuya@tcha.org>
parents:
36105
diff
changeset
|
16 procutil.getpid = getpid |