Mercurial > hgrepos > DevTools > mercurial-extensions
diff extensions/kwarchive.py @ 291:31d5d77c297d
Begin real keyword expansion for subrepos
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Wed, 23 Jan 2019 09:35:44 +0100 |
| parents | fd493de7a669 |
| children | 241b0b9eaa19 |
line wrap: on
line diff
--- a/extensions/kwarchive.py Tue Jan 22 09:40:31 2019 +0100 +++ b/extensions/kwarchive.py Wed Jan 23 09:35:44 2019 +0100 @@ -368,12 +368,31 @@ else: ui.write("$%s: %s $\n" % (key, file_keywords[key])) if opts.get("subrepos"): - for subpath in sorted(ctx.substate): - ui.write("SUBPATH: " + subpath + "\n"); - subrep = ctx.workingsub(subpath) - ui.write(repr(subrep) + ": subrelpath=" + subrepo.subrelpath(subrep) - + "reporelpath=" + subrepo.reporelpath(subrep._repo) - + '\n') + _kwprint_subrepos(ctx, ui) + + +def _kwprint_subrepos(ctx, ui): + for subpath in sorted(ctx.substate): + subrep = ctx.workingsub(subpath) + subctx = subrep._getctx() + keywords = make_node_keywords(ui, subrep._repo, subctx, subpath) + ui.write("KWD: " + repr(keywords) + "\n") + # Recursively check for other subrepos + _test_subrepos(subctx, ui) + + +def _test_subrepos(ctx, ui): + for subpath in sorted(ctx.substate): + ui.write("SUBPATH: " + subpath + "\n"); + subrep = ctx.workingsub(subpath) + ui.write(repr(subrep) + ": subrelpath=" + subrepo.subrelpath(subrep) + + " reporelpath=" + subrepo.reporelpath(subrep._repo) + + '\n') + # Yes(!) + assert subrepo.subrelpath(subrep) == subrepo.reporelpath(subrep._repo) + assert subrepo.subrelpath(subrep).endswith(subpath) + ui.write(" " + repr(subrep._getctx()) + '\n') + _test_subrepos(subrep._getctx(), ui) def patch_archiver_class(archivername, filter):
