[PATCH] debuginstall: print compression engine support
Gregory Szorc
gregory.szorc at gmail.com
Sat Nov 19 03:58:28 UTC 2016
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1479527805 28800
# Fri Nov 18 19:56:45 2016 -0800
# Node ID a3b70554ff2a25fa429bbf388850b982b064cb93
# Parent 9375077f1ace71dfa2fc87a1d4eaeae8de267e20
debuginstall: print compression engine support
Since compression engines may be provided by extensions and since
not all registered compression engines may be available to use,
it seems useful to provide a mechanism to see the state of known
compression engines.
This commit teaches `hg debuginstall` to print info on known and
available compression engines.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2579,6 +2579,16 @@ def debuginstall(ui, **opts):
problems += 1
fm.condwrite(err, 'extensionserror', " %s\n", err)
+ compengines = util.compengines._engines.values()
+ fm.write('compengines', _('checking registered compression engines (%s)\n'),
+ fm.formatlist(sorted(e.name() for e in compengines),
+ name='compengine', fmt='%s', sep=', '))
+ fm.write('compenginesavail', _('checking available compression engines '
+ '(%s)\n'),
+ fm.formatlist(sorted(e.name() for e in compengines
+ if e.available()),
+ name='compengine', fmt='%s', sep=', '))
+
# templates
p = templater.templatepaths()
fm.write('templatedirs', 'checking templates (%s)...\n', ' '.join(p))
diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -11,6 +11,8 @@ hg debuginstall
checking Mercurial custom build (*) (glob)
checking module policy (*) (glob)
checking installed modules (*mercurial)... (glob)
+ checking registered compression engines (*zlib*) (glob)
+ checking available compression engines (*zlib*) (glob)
checking templates (*mercurial?templates)... (glob)
checking default template (*mercurial?templates?map-cmdline.default) (glob)
checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -21,6 +23,8 @@ hg debuginstall JSON
$ hg debuginstall -Tjson | sed 's|\\\\|\\|g'
[
{
+ "compengines": ["bz2", "bz2truncated", "none", "zlib", "zstd"],
+ "compenginesavail": ["bz2", "bz2truncated", "none", "zlib", "zstd"],
"defaulttemplate": "*mercurial?templates?map-cmdline.default", (glob)
"defaulttemplateerror": null,
"defaulttemplatenotfound": "default",
@@ -58,6 +62,8 @@ hg debuginstall with no username
checking Mercurial custom build (*) (glob)
checking module policy (*) (glob)
checking installed modules (*mercurial)... (glob)
+ checking registered compression engines (*zlib*) (glob)
+ checking available compression engines (*zlib*) (glob)
checking templates (*mercurial?templates)... (glob)
checking default template (*mercurial?templates?map-cmdline.default) (glob)
checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -85,6 +91,8 @@ path variables are expanded (~ is the sa
checking Mercurial custom build (*) (glob)
checking module policy (*) (glob)
checking installed modules (*mercurial)... (glob)
+ checking registered compression engines (*zlib*) (glob)
+ checking available compression engines (*zlib*) (glob)
checking templates (*mercurial?templates)... (glob)
checking default template (*mercurial?templates?map-cmdline.default) (glob)
checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
More information about the Mercurial-devel
mailing list