[cig-commits] commit: do not use Mercurial's util.walkrepos() anymore
Mercurial
hg at geodynamics.org
Mon Nov 24 11:27:03 PST 2008
changeset: 43:60036a82c3c4
user: Robin Farine <robin.farine at terminus.org>
date: Wed Jan 10 11:10:12 2007 +0100
files: forest.py
description:
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.
diff -r 5bd28695a35b -r 60036a82c3c4 forest.py
--- 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 @@ def enumerate_repos(ui, top):
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
More information about the CIG-COMMITS
mailing list