diff mercurial/cmdutil.py @ 36047:55e8efa2451a

subrepo: split non-core functions to new module Resolves import cycle caused by subrepo -> cmdutil. Still we have another cycle, cmdutil -> context -> subrepo, but where I think importing context is wrong. Perhaps we'll need repo.makememctx().
author Yuya Nishihara <yuya@tcha.org>
date Tue, 06 Feb 2018 22:36:38 +0900
parents 386c1e45e671
children 46a54de96a54
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Feb 07 23:22:53 2018 +0900
+++ b/mercurial/cmdutil.py	Tue Feb 06 22:36:38 2018 +0900
@@ -40,6 +40,7 @@
     rewriteutil,
     scmutil,
     smartset,
+    subrepoutil,
     templater,
     util,
     vfs as vfsmod,
@@ -2307,13 +2308,12 @@
         # subrepo.precommit(). To minimize the risk of this hack, we do
         # nothing if .hgsub does not exist.
         if '.hgsub' in wctx or '.hgsub' in old:
-            from . import subrepo  # avoid cycle: cmdutil -> subrepo -> cmdutil
-            subs, commitsubs, newsubstate = subrepo.precommit(
+            subs, commitsubs, newsubstate = subrepoutil.precommit(
                 ui, wctx, wctx._status, matcher)
             # amend should abort if commitsubrepos is enabled
             assert not commitsubs
             if subs:
-                subrepo.writestate(repo, newsubstate)
+                subrepoutil.writestate(repo, newsubstate)
 
         filestoamend = set(f for f in wctx.files() if matcher(f))