##// END OF EJS Templates
phabricator: warn if unable to amend, instead of aborting after posting...
phabricator: warn if unable to amend, instead of aborting after posting There was a divergence in behavior here between obsolete and strip based amending. I first noticed the abort when testing outside of the test harness, but then had trouble recreating it here after reverting the code changes. It turns out, strip based amend was successfully amending the public commit after it was posted! It looks like the protection is in the `commit --amend` command, not in the underlying code that it calls. I considered doing a preflight check and aborting. But the locks are only acquired at the end, if amending, and this is too large a section of code to be wrapped in a maybe-it's-held-or-not context manager for my tastes. Additionally, some people do post-push reviews, and amending is the default behavior, so they shouldn't see a misleading error message. The lack of a 'Differential Revision' entry in the commit message breaks a {phabreview} test, so it had to be partially conditionalized.

File last commit:

r37137:d4a2e0d5 default
r41198:0101a35d default
Show More
test-config-env.py
54 lines | 1.3 KiB | text/x-python | PythonLexer
/ tests / test-config-env.py
Jun Wu
rcutil: let environ override system configs (BC)...
r31685 # Test the config layer generated by environment variables
from __future__ import absolute_import, print_function
import os
from mercurial import (
encoding,
rcutil,
ui as uimod,
Matt Harbison
tests: print Unix style paths in *.py tests...
r31857 util,
Jun Wu
rcutil: let environ override system configs (BC)...
r31685 )
Yuya Nishihara
procutil: bulk-replace util.std* to point to new module
r37137 from mercurial.utils import (
procutil,
)
Yuya Nishihara
py3: byte-stringify test-config.t and test-config-env.py
r36748 testtmp = encoding.environ[b'TESTTMP']
Jun Wu
rcutil: let environ override system configs (BC)...
r31685
# prepare hgrc files
def join(name):
return os.path.join(testtmp, name)
Yuya Nishihara
py3: byte-stringify test-config.t and test-config-env.py
r36748 with open(join(b'sysrc'), 'wb') as f:
f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n')
Jun Wu
rcutil: let environ override system configs (BC)...
r31685
Yuya Nishihara
py3: byte-stringify test-config.t and test-config-env.py
r36748 with open(join(b'userrc'), 'wb') as f:
f.write(b'[ui]\neditor=e1')
Jun Wu
rcutil: let environ override system configs (BC)...
r31685
# replace rcpath functions so they point to the files above
def systemrcpath():
Yuya Nishihara
py3: byte-stringify test-config.t and test-config-env.py
r36748 return [join(b'sysrc')]
Jun Wu
rcutil: let environ override system configs (BC)...
r31685
def userrcpath():
Yuya Nishihara
py3: byte-stringify test-config.t and test-config-env.py
r36748 return [join(b'userrc')]
Jun Wu
rcutil: let environ override system configs (BC)...
r31685
rcutil.systemrcpath = systemrcpath
rcutil.userrcpath = userrcpath
os.path.isdir = lambda x: False # hack: do not load default.d/*.rc
# utility to print configs
def printconfigs(env):
encoding.environ = env
rcutil._rccomponents = None # reset cache
ui = uimod.ui.load()
for section, name, value in ui.walkconfig():
source = ui.configsource(section, name)
Yuya Nishihara
procutil: bulk-replace util.std* to point to new module
r37137 procutil.stdout.write(b'%s.%s=%s # %s\n'
% (section, name, value, util.pconvert(source)))
procutil.stdout.write(b'\n')
Jun Wu
rcutil: let environ override system configs (BC)...
r31685
# environment variable overrides
printconfigs({})
Yuya Nishihara
py3: byte-stringify test-config.t and test-config-env.py
r36748 printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'})