From patchwork Fri Mar 6 13:46:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D8248: debuginstall: print if Rust extensions are installed From: phabricator X-Patchwork-Id: 45549 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Fri, 6 Mar 2020 13:46:26 +0000 Alphare created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This should make it easier to use the Rust extensions. Another patch on will be exposing a version and more useful information, but it can only be done on top of this very patch, since it is targeting the stable branch and the API has already changed on the default branch. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D8248 AFFECTED FILES mercurial/debugcommands.py rust/hg-cpython/src/lib.rs CHANGE DETAILS To: Alphare, #hg-reviewers Cc: mercurial-devel diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs --- a/rust/hg-cpython/src/lib.rs +++ b/rust/hg-cpython/src/lib.rs @@ -72,6 +72,12 @@ "PatternError", py.get_type::(), )?; + /// Change this version whenever the API is changed + m.add( + py, + "version", + 0, + )?; Ok(()) }); diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1497,6 +1497,18 @@ pythonlib or _(b"unknown"), ) + try: + from mercurial import rustext + rustext.__doc__ # trigger lazy import + except ImportError: + rustext = None + + fm.write( + b'', + _(b"checking Rust extensions (%s)\n"), + b'missing' if rustext is None else 'installed', + ) + security = set(sslutil.supportedprotocols) if sslutil.hassni: security.add(b'sni')