changeset 68:00cc9acdcf3e

`hg ftrees` now uses the Forest framework
author Simon Law <simon@akoha.org>
date Mon, 27 Aug 2007 13:49:23 -0400
parents f0d10035b058
children cb22e7675abc
files forest.py
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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.