changeset 1829 | b0f6af327fd4 |
parent 1635 | ae61937c61c5 |
child 1830 | 4ced57680ce7 |
--- a/mercurial/util.py Thu Feb 09 17:18:43 2006 -0600 +++ b/mercurial/util.py Fri Feb 10 11:25:07 2006 -0800 @@ -690,3 +690,16 @@ (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