D6262: rust-discovery: using from Python code
gracinet (Georges Racinet)
phabricator at mercurial-scm.org
Wed Apr 17 12:17:30 UTC 2019
gracinet created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
As previously done in other topics, the Rust version is used if it's been
built.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6262
AFFECTED FILES
mercurial/setdiscovery.py
CHANGE DETAILS
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -46,6 +46,11 @@
import random
from .i18n import _
+try:
+ from .rustext import discovery as rustdisco
+except ImportError:
+ rustdisco = None
+
from .node import (
nullid,
nullrev,
@@ -318,7 +323,10 @@
# full blown discovery
- disco = partialdiscovery(local, ownheads)
+ if rustdisco is not None:
+ disco = rustdisco.PartialDiscovery(local.changelog.index, ownheads)
+ else:
+ disco = partialdiscovery(local, ownheads)
# treat remote heads (and maybe own heads) as a first implicit sample
# response
disco.addcommons(knownsrvheads)
To: gracinet, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list