Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
36046:006ff7268c5c | 36047:55e8efa2451a |
---|---|
38 registrar, | 38 registrar, |
39 revlog, | 39 revlog, |
40 rewriteutil, | 40 rewriteutil, |
41 scmutil, | 41 scmutil, |
42 smartset, | 42 smartset, |
43 subrepoutil, | |
43 templater, | 44 templater, |
44 util, | 45 util, |
45 vfs as vfsmod, | 46 vfs as vfsmod, |
46 ) | 47 ) |
47 stringio = util.stringio | 48 stringio = util.stringio |
2305 | 2306 |
2306 # Check subrepos. This depends on in-place wctx._status update in | 2307 # Check subrepos. This depends on in-place wctx._status update in |
2307 # subrepo.precommit(). To minimize the risk of this hack, we do | 2308 # subrepo.precommit(). To minimize the risk of this hack, we do |
2308 # nothing if .hgsub does not exist. | 2309 # nothing if .hgsub does not exist. |
2309 if '.hgsub' in wctx or '.hgsub' in old: | 2310 if '.hgsub' in wctx or '.hgsub' in old: |
2310 from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil | 2311 subs, commitsubs, newsubstate = subrepoutil.precommit( |
2311 subs, commitsubs, newsubstate = subrepo.precommit( | |
2312 ui, wctx, wctx._status, matcher) | 2312 ui, wctx, wctx._status, matcher) |
2313 # amend should abort if commitsubrepos is enabled | 2313 # amend should abort if commitsubrepos is enabled |
2314 assert not commitsubs | 2314 assert not commitsubs |
2315 if subs: | 2315 if subs: |
2316 subrepo.writestate(repo, newsubstate) | 2316 subrepoutil.writestate(repo, newsubstate) |
2317 | 2317 |
2318 filestoamend = set(f for f in wctx.files() if matcher(f)) | 2318 filestoamend = set(f for f in wctx.files() if matcher(f)) |
2319 | 2319 |
2320 changes = (len(filestoamend) > 0) | 2320 changes = (len(filestoamend) > 0) |
2321 if changes: | 2321 if changes: |