diff -r 2f4a399a8787 -r e60aaae83323 mercurial/util.py --- a/mercurial/util.py Mon Dec 15 12:02:18 2008 -0800 +++ b/mercurial/util.py Thu Dec 18 22:32:48 2008 +0100 @@ -1876,7 +1876,7 @@ else: return "%s..." % (text[:maxlength-3]) -def walkrepos(path, followsym=False, seen_dirs=None): +def walkrepos(path, followsym=False, seen_dirs=None, recurse=False): '''yield every hg repository under path, recursively.''' def errhandler(err): if err.filename == path: @@ -1901,11 +1901,16 @@ _add_dir_if_not_there(seen_dirs, path) for root, dirs, files in os.walk(path, topdown=True, onerror=errhandler): if '.hg' in dirs: - dirs[:] = [] # don't descend further yield root # found a repository - qroot = os.path.join(root, '.hg', 'patches') - if os.path.isdir(os.path.join(qroot, '.hg')): - yield qroot # we have a patch queue repo here + if recurse: + # avoid recursing inside the .hg directory + # the mq repository is added in any case + dirs.remove('.hg') + qroot = os.path.join(root, '.hg', 'patches') + if os.path.isdir(os.path.join(qroot, '.hg')): + yield qroot # we have a patch queue repo here + else: + dirs[:] = [] # don't descend further elif followsym: newdirs = [] for d in dirs: