##// END OF EJS Templates
itersubrepos: move to scmutil to break a direct import cycle
Augie Fackler -
r20392:d4f804ca default
parent child Browse files
Show More
@@ -10,7 +10,7 b' from i18n import _'
10 import os, sys, errno, re, tempfile
10 import os, sys, errno, re, tempfile
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
12 import match as matchmod
12 import match as matchmod
13 import subrepo, context, repair, graphmod, revset, phases, obsolete, pathutil
13 import context, repair, graphmod, revset, phases, obsolete, pathutil
14 import changelog
14 import changelog
15 import bookmarks
15 import bookmarks
16 import lock as lockmod
16 import lock as lockmod
@@ -629,7 +629,7 b' def diffordiffstat(ui, repo, diffopts, n'
629 if listsubrepos:
629 if listsubrepos:
630 ctx1 = repo[node1]
630 ctx1 = repo[node1]
631 ctx2 = repo[node2]
631 ctx2 = repo[node2]
632 for subpath, sub in subrepo.itersubrepos(ctx1, ctx2):
632 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
633 tempnode2 = node2
633 tempnode2 = node2
634 try:
634 try:
635 if node2 is not None:
635 if node2 is not None:
@@ -1579,7 +1579,7 b' class localrepository(object):'
1579 r = modified, added, removed, deleted, unknown, ignored, clean
1579 r = modified, added, removed, deleted, unknown, ignored, clean
1580
1580
1581 if listsubrepos:
1581 if listsubrepos:
1582 for subpath, sub in subrepo.itersubrepos(ctx1, ctx2):
1582 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
1583 if working:
1583 if working:
1584 rev2 = None
1584 rev2 = None
1585 else:
1585 else:
@@ -20,6 +20,16 b' else:'
20 systemrcpath = scmplatform.systemrcpath
20 systemrcpath = scmplatform.systemrcpath
21 userrcpath = scmplatform.userrcpath
21 userrcpath = scmplatform.userrcpath
22
22
23 def itersubrepos(ctx1, ctx2):
24 """find subrepos in ctx1 or ctx2"""
25 # Create a (subpath, ctx) mapping where we prefer subpaths from
26 # ctx1. The subpaths from ctx2 are important when the .hgsub file
27 # has been modified (in ctx2) but not yet committed (in ctx1).
28 subpaths = dict.fromkeys(ctx2.substate, ctx2)
29 subpaths.update(dict.fromkeys(ctx1.substate, ctx1))
30 for subpath, ctx in sorted(subpaths.iteritems()):
31 yield subpath, ctx.sub(subpath)
32
23 def nochangesfound(ui, repo, excluded=None):
33 def nochangesfound(ui, repo, excluded=None):
24 '''Report no changes for push/pull, excluded is None or a list of
34 '''Report no changes for push/pull, excluded is None or a list of
25 nodes excluded from the push/pull.
35 nodes excluded from the push/pull.
@@ -326,16 +326,6 b' def _sanitize(ui, path):'
326 os.unlink(os.path.join(dirname, f))
326 os.unlink(os.path.join(dirname, f))
327 os.walk(path, v, None)
327 os.walk(path, v, None)
328
328
329 def itersubrepos(ctx1, ctx2):
330 """find subrepos in ctx1 or ctx2"""
331 # Create a (subpath, ctx) mapping where we prefer subpaths from
332 # ctx1. The subpaths from ctx2 are important when the .hgsub file
333 # has been modified (in ctx2) but not yet committed (in ctx1).
334 subpaths = dict.fromkeys(ctx2.substate, ctx2)
335 subpaths.update(dict.fromkeys(ctx1.substate, ctx1))
336 for subpath, ctx in sorted(subpaths.iteritems()):
337 yield subpath, ctx.sub(subpath)
338
339 def subrepo(ctx, path):
329 def subrepo(ctx, path):
340 """return instance of the right subrepo class for subrepo in path"""
330 """return instance of the right subrepo class for subrepo in path"""
341 # subrepo inherently violates our import layering rules
331 # subrepo inherently violates our import layering rules
@@ -38,7 +38,7 b' these may expose other cycles.'
38 mercurial/ui.py mixed imports
38 mercurial/ui.py mixed imports
39 stdlib: formatter
39 stdlib: formatter
40 relative: config, error, scmutil, util
40 relative: config, error, scmutil, util
41 Import cycle: mercurial.cmdutil -> mercurial.subrepo -> mercurial.cmdutil
42 Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview
41 Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview
43 Import cycle: mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.match -> mercurial.fileset
42 Import cycle: mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.match -> mercurial.fileset
43 Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil -> mercurial.cmdutil
44 Import cycle: mercurial.filemerge -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.filemerge
44 Import cycle: mercurial.filemerge -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.filemerge
General Comments 0
You need to be logged in to leave comments. Login now