Mercurial > public > mercurial-scm > hg-stable
diff mercurial/scmutil.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 | a6cf48b2880d |
children | 9ad6dae67845 |
line wrap: on
line diff
--- a/mercurial/scmutil.py Fri Feb 07 02:59:46 2014 +0100 +++ b/mercurial/scmutil.py Mon Feb 03 18:36:00 2014 -0500 @@ -20,6 +20,16 @@ systemrcpath = scmplatform.systemrcpath userrcpath = scmplatform.userrcpath +def itersubrepos(ctx1, ctx2): + """find subrepos in ctx1 or ctx2""" + # Create a (subpath, ctx) mapping where we prefer subpaths from + # ctx1. The subpaths from ctx2 are important when the .hgsub file + # has been modified (in ctx2) but not yet committed (in ctx1). + subpaths = dict.fromkeys(ctx2.substate, ctx2) + subpaths.update(dict.fromkeys(ctx1.substate, ctx1)) + for subpath, ctx in sorted(subpaths.iteritems()): + yield subpath, ctx.sub(subpath) + def nochangesfound(ui, repo, excluded=None): '''Report no changes for push/pull, excluded is None or a list of nodes excluded from the push/pull.