changeset 36010:46a54de96a54

merge: cut import cycle at merge -> extensions This seems less bad because checking fsmonitor looks like a temporary hack, and cmdutil -> mergemod should be a valid dependency.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 06 Feb 2018 22:55:02 +0900
parents 55e8efa2451a
children c02200b11c39
files mercurial/cmdutil.py mercurial/merge.py
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Feb 06 22:36:38 2018 +0900
+++ b/mercurial/cmdutil.py	Tue Feb 06 22:55:02 2018 +0900
@@ -31,6 +31,7 @@
     formatter,
     logcmdutil,
     match as matchmod,
+    merge as mergemod,
     obsolete,
     patch,
     pathutil,
@@ -220,7 +221,6 @@
 
 def dorecord(ui, repo, commitfunc, cmdsuggest, backupall,
             filterfn, *pats, **opts):
-    from . import merge as mergemod
     opts = pycompat.byteskwargs(opts)
     if not ui.interactive():
         if cmdsuggest:
@@ -557,8 +557,6 @@
     return '\n'.join(commentedlines) + '\n'
 
 def _conflictsmsg(repo):
-    # avoid merge cycle
-    from . import merge as mergemod
     mergestate = mergemod.mergestate.read(repo)
     if not mergestate.active():
         return
--- a/mercurial/merge.py	Tue Feb 06 22:36:38 2018 +0900
+++ b/mercurial/merge.py	Tue Feb 06 22:55:02 2018 +0900
@@ -25,7 +25,6 @@
 from . import (
     copies,
     error,
-    extensions,
     filemerge,
     match as matchmod,
     obsutil,
@@ -1992,6 +1991,8 @@
         fsmonitorthreshold = repo.ui.configint('fsmonitor',
                                                'warn_update_file_count')
         try:
+            # avoid cycle: extensions -> cmdutil -> merge
+            from . import extensions
             extensions.find('fsmonitor')
             fsmonitorenabled = repo.ui.config('fsmonitor', 'mode') != 'off'
             # We intentionally don't look at whether fsmonitor has disabled