changeset 43:60036a82c3c4

do not use Mercurial's util.walkrepos() anymore The extension depends on a patched version of util.walkrepos() but the patches were not merged upstream. It is hence more convenient to duplicate this functionality in the extension rather than depending on a patched Mercurial distribution.
author Robin Farine <robin.farine@terminus.org>
date Wed, 10 Jan 2007 11:10:12 +0100
parents 5bd28695a35b
children 3a2665d193d0
files forest.py
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Wed Jan 10 10:17:25 2007 +0100
+++ b/forest.py	Wed Jan 10 11:10:12 2007 +0100
@@ -58,7 +58,23 @@
     Return a list of roots in filesystem representation.
     """
 
-    res = list(util.walkrepos(top))
+    def errhandler(err):
+        if err.filename == top:
+            raise err
+
+    res = []
+    paths = [top]
+    while paths:
+        path = paths.pop()
+        for root, dirs, files in os.walk(path, onerror=errhandler):
+            for d in dirs:
+                if d == '.hg':
+                    res.append(root)
+                    dirs.remove(d)
+                else:
+                    p = os.path.join(root, d)
+                    if os.path.islink(p):
+                        paths.append(p)
     res.sort()
     return res