# HG changeset patch # User Raphaël Gomès # Date 2022-02-28 17:34:23 # Node ID d4486810a1795fba9521449b8885ced034f3a6dd # Parent f0081a551f372543a62f3742e2ec7e1eaa60cc92 merge: remove direct rustmod reference We shouldn't rely on this member being present in `dirstate.py`, this creates unnecessary coupling. This also can trigger certain issues in edge-cases where the policy is changed at runtime or multiple Python environments fight, which is an added bonus. Differential Revision: https://phab.mercurial-scm.org/D12217 diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -25,6 +25,7 @@ from . import ( mergestate as mergestatemod, obsutil, pathutil, + policy, pycompat, scmutil, subrepoutil, @@ -1764,9 +1765,9 @@ def _advertisefsmonitor(repo, num_gets, b'fsmonitor', b'warn_update_file_count' ) # avoid cycle dirstate -> sparse -> merge -> dirstate - from . import dirstate + dirstate_rustmod = policy.importrust("dirstate") - if dirstate.rustmod is not None: + if dirstate_rustmod is not None: # When using rust status, fsmonitor becomes necessary at higher sizes fsmonitorthreshold = repo.ui.configint( b'fsmonitor',