# HG changeset patch # User Simon Law # Date 1188236963 14400 # Node ID 00cc9acdcf3e113668d48bdb2c9744e1a5a740f7 # Parent f0d10035b05815b1743dacd64a5f5332a3ba2549 `hg ftrees` now uses the Forest framework diff -r f0d10035b058 -r 00cc9acdcf3e forest.py --- a/forest.py Mon Aug 27 13:48:25 2007 -0400 +++ b/forest.py Mon Aug 27 13:49:23 2007 -0400 @@ -1115,18 +1115,24 @@ prehooks=[lambda tree: check_mq(tree)]) -def trees(ui, repo, convert=False, walkhg='', **opts): - """List the roots of the repositories.""" +def trees(ui, top, **opts): + """show the roots of the repositories + + Show the roots of the trees in the forest. + + By default, show the absolute path of each repository. With + --convert, show the portable Mercurial path. + """ - walkhg = walkhgenabled(ui, walkhg) - if convert: - l = repo.forests(walkhg) - else: - root = repo.root - l = [(f == "." and root) or os.path.join(root, f) - for f in repo.forests(walkhg)] - for t in l: - ui.write(t + '\n') + forest = Forest(top=top, + walkhg=walkhgenabled(ui, opts['walkhg'])) + convert = opts['convert'] + for tree in forest.trees: + if convert: + ui.write("%s\n" % relpath(top.root, tree.root)) + else: + ui.write("%s\n" % util.localpath(tree.root)) + def update(ui, toprepo, snapfile=None, tip=False, walkhg='', **opts): """Update working directories to tip or according to a snapshot file.