changeset 52:504a07390de3

test-forest tests now pass.
author Simon Law <simon@akoha.org>
date Tue, 10 Jul 2007 12:20:52 -0400
parents d3d1b4a1a90d
children 5f46981d6b9c
files forest.py
diffstat 1 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Tue Jul 10 10:20:14 2007 -0400
+++ b/forest.py	Tue Jul 10 12:20:52 2007 -0400
@@ -244,10 +244,12 @@
 
 
 def mq_patches_applied(rpath):
-    if rpath.startswith("file:"):
+    if rpath.startswith("ssh:"):
+        raise util.Abort(_("'%s' starts with ssh:") % rpath)
+    elif rpath.startswith("http:"):
+        raise util.Abort(_("'%s' starts with http:") % rpath)
+    elif rpath.startswith("file:"):
         rpath = rpath[len("file:"):]
-    else:
-        raise util.Abort(_("'%s' does not start with file:") % rpath)
     rpath = os.path.join(rpath, ".hg")
     entries = os.listdir(rpath)
     for e in entries:
@@ -348,6 +350,8 @@
         rootmap = {}
         self.trees = []
         top = repo.url()
+        if hasattr(repo, "root"):
+            top = repo.root
         for f in repo.forests(walkhg):
             relpath = util.pconvert(f)
             if f == ".":
@@ -356,7 +360,7 @@
             if relpath != '.':
                 repo = hg.repository(ui, abspath)
             if mq_fatal and mq_patches_applied(abspath):
-                raise util.Abort(_("'%s' has mq patches applied") % abspath)
+                raise util.Abort(_("'%s' has mq patches applied") % relpath)
             if tip:
                 rev = 'tip'
             else:
@@ -394,11 +398,15 @@
             if not os.path.exists(destpfx):
                 os.makedirs(destpfx)
         opts['rev'] = [rev]
-        commands.clone(ui, repo.url(), destpath, **opts)
+        url = repo.url()
+        if hasattr(repo, "root"):
+            url = repo.root
+        commands.clone(ui, url, destpath, **opts)
 
     snapshot = ForestSnapshot()
     repo = hg.repository(ui, source)
-    snapshot.update(ui, repo, False, walkhgenabled(ui, walkhg), True)
+    snapshot.update(ui, repo, isinstance(repo, localrepo.localrepository),
+                    walkhgenabled(ui, walkhg), True)
     snapshot(ui, repo, doit, mq_check=False)
 
 
@@ -509,13 +517,10 @@
 
     walkhg = walkhgenabled(ui, walkhg)
     if convert:
-        pfxlen = len(repo.root + os.sep)
-        l = [util.pconvert(p[pfxlen:])
-             for p in repo.forests(walkhg)]
-        l.remove('')
-        l.insert(0, '.')
+        l = repo.forests(walkhg)
     else:
-        l = repo.forests(walkhg)
+        root = repo.root
+        l = [os.sep.join(root, f) for f in repo.forests(walkhg)]
     for t in l:
         ui.write(t + '\n')