Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 20392:d4f804caa0ed
itersubrepos: move to scmutil to break a direct import cycle
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Mon, 03 Feb 2014 18:36:00 -0500 |
parents | 427d672c0e4e |
children | 49f2d5644f04 |
comparison
equal
deleted
inserted
replaced
20391:466e4c574db0 | 20392:d4f804caa0ed |
---|---|
324 _("warning: removing potentially hostile .hg/hgrc in '%s'" | 324 _("warning: removing potentially hostile .hg/hgrc in '%s'" |
325 % path)) | 325 % 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 |
342 # because it wants to make repo objects from deep inside the stack | 332 # because it wants to make repo objects from deep inside the stack |
343 # so we manually delay the circular imports to not break | 333 # so we manually delay the circular imports to not break |