mirror of
https://github.com/facebook/sapling.git
synced 2024-12-29 08:02:24 +03:00
run-tests: add internal:none editor
Summary: Rather than using a Python program, simulate having no editor during tests using `internal:none`. Reviewed By: quark-zju, ikostia Differential Revision: D23152446 fbshipit-source-id: 5560f58885ee5959c62f0ac8bcf0483b9c3072f6
This commit is contained in:
parent
a25521a48b
commit
44b7724014
@ -1576,30 +1576,31 @@ def debuginstall(ui, **opts):
|
||||
# editor
|
||||
editor = ui.geteditor()
|
||||
editor = util.expandpath(editor)
|
||||
fm.write("editor", _("checking commit editor... (%s)\n"), editor)
|
||||
cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
|
||||
fm.condwrite(
|
||||
not cmdpath and editor == "vi",
|
||||
"vinotfound",
|
||||
_(
|
||||
" No commit editor set and can't find %s in PATH\n"
|
||||
" (specify a commit editor in your configuration"
|
||||
" file)\n"
|
||||
),
|
||||
not cmdpath and editor == "vi" and editor,
|
||||
)
|
||||
fm.condwrite(
|
||||
not cmdpath and editor != "vi",
|
||||
"editornotfound",
|
||||
_(
|
||||
" Can't find editor '%s' in PATH\n"
|
||||
" (specify a commit editor in your configuration"
|
||||
" file)\n"
|
||||
),
|
||||
not cmdpath and editor,
|
||||
)
|
||||
if not cmdpath and editor != "vi":
|
||||
problems += 1
|
||||
fm.write("editor", _("checking commit editor (%s)\n"), editor)
|
||||
if editor != "internal:none":
|
||||
cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
|
||||
fm.condwrite(
|
||||
not cmdpath and editor == "vi",
|
||||
"vinotfound",
|
||||
_(
|
||||
" No commit editor set and can't find %s in PATH\n"
|
||||
" (specify a commit editor in your configuration"
|
||||
" file)\n"
|
||||
),
|
||||
not cmdpath and editor == "vi" and editor,
|
||||
)
|
||||
fm.condwrite(
|
||||
not cmdpath and editor != "vi",
|
||||
"editornotfound",
|
||||
_(
|
||||
" Can't find editor '%s' in PATH\n"
|
||||
" (specify a commit editor in your configuration"
|
||||
" file)\n"
|
||||
),
|
||||
not cmdpath and editor,
|
||||
)
|
||||
if not cmdpath and editor != "vi":
|
||||
problems += 1
|
||||
|
||||
# check username
|
||||
username = None
|
||||
|
@ -1361,7 +1361,9 @@ class ui(object):
|
||||
editor = self.geteditor()
|
||||
|
||||
# Special cases to avoid shelling out
|
||||
if editor == "cat":
|
||||
if editor == "internal:none":
|
||||
pass
|
||||
elif editor == "cat":
|
||||
# Print the text
|
||||
self.write(text)
|
||||
elif editor == "cat>":
|
||||
|
@ -1504,9 +1504,7 @@ class Test(unittest.TestCase):
|
||||
defineport(port)
|
||||
env["HGRCPATH"] = self._gethgrcpath()
|
||||
env["DAEMON_PIDS"] = os.path.join(self._threadtmp, b"daemon.pids")
|
||||
env["HGEDITOR"] = (
|
||||
'"' + PYTHON.decode("utf-8") + '"' + ' -c "import sys; sys.exit(0)"'
|
||||
).encode("utf-8")
|
||||
env["HGEDITOR"] = "internal:none"
|
||||
env["HGMERGE"] = "internal:merge"
|
||||
env["HGUSER"] = "test"
|
||||
env["HGENCODING"] = "ascii"
|
||||
|
@ -15,7 +15,7 @@ hg debuginstall
|
||||
checking available compression engines for wire protocol (*zlib*) (glob)
|
||||
checking templates (*mercurial?templates)... (glob)
|
||||
checking default template (default)
|
||||
checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
|
||||
checking commit editor (internal:none)
|
||||
checking username (test)
|
||||
no problems detected
|
||||
|
||||
@ -29,8 +29,7 @@ hg debuginstall JSON
|
||||
"defaulttemplate": "default",
|
||||
"defaulttemplateerror": null,
|
||||
"defaulttemplatenotfound": "default",
|
||||
"editor": "* -c \"import sys; sys.exit(0)\"", (glob)
|
||||
"editornotfound": false,
|
||||
"editor": "internal:none",
|
||||
"encoding": "utf-8",
|
||||
"encodingerror": null,
|
||||
"extensionserror": null,
|
||||
@ -44,8 +43,7 @@ hg debuginstall JSON
|
||||
"pythonver": "*.*.*", (glob)
|
||||
"templatedirs": "*mercurial?templates", (glob)
|
||||
"username": "test",
|
||||
"usernameerror": null,
|
||||
"vinotfound": false
|
||||
"usernameerror": null
|
||||
}
|
||||
]
|
||||
|
||||
@ -66,7 +64,7 @@ hg debuginstall with no username
|
||||
checking available compression engines for wire protocol (*zlib*) (glob)
|
||||
checking templates (*mercurial?templates)... (glob)
|
||||
checking default template (default)
|
||||
checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
|
||||
checking commit editor (internal:none)
|
||||
checking username...
|
||||
no username supplied
|
||||
(specify a username in your configuration file)
|
||||
@ -84,7 +82,7 @@ exception message in JSON
|
||||
"defaulttemplateerror": null,
|
||||
"encodingerror": "unknown encoding: invalidenc",
|
||||
"extensionserror": null,
|
||||
"usernameerror": "no username supplied",
|
||||
"usernameerror": "no username supplied"
|
||||
|
||||
path variables are expanded (~ is the same as $TESTTMP)
|
||||
$ mkdir tools
|
||||
@ -108,7 +106,7 @@ path variables are expanded (~ is the same as $TESTTMP)
|
||||
checking available compression engines for wire protocol (*zlib*) (glob)
|
||||
checking templates (*mercurial?templates)... (glob)
|
||||
checking default template (default)
|
||||
checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
|
||||
checking commit editor (internal:none)
|
||||
checking username (test)
|
||||
no problems detected
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user