diff mercurial/util.py @ 1829:b0f6af327fd4

hgwebdir: export collections of repos now you can use [collections] section in hgweb.config to export entire tree of repos.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 10 Feb 2006 11:25:07 -0800
parents ae61937c61c5
children 4ced57680ce7
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -690,3 +690,16 @@ def datestr(date=None, format='%c'):
             (time.strftime(format, time.gmtime(float(t) - tz)),
              -tz / 3600,
              ((-tz % 3600) / 60)))
+
+def walkrepos(path):
+    '''yield every hg repository under path, recursively.'''
+    def errhandler(err):
+        if err.filename == path:
+            raise err
+
+    for root, dirs, files in os.walk(path, onerror=errhandler):
+        for d in dirs:
+            if d == '.hg':
+                yield root
+                dirs[:] = []
+                break