scripts/find-hg-repos.py
author Dan Minor <dminor@mozilla.com>
Fri, 18 Dec 2015 15:12:07 -0500
changeset 362083 2248273cff1c9789e941b14cb0a303dbfca0ff98
parent 360739 93d6087733f22548da274bde27a00c1f1a4ff54a
child 362532 f1f7808d7bbae999e5d1b67cd0b1dbc76c4a3aed
permissions -rwxr-xr-x
mozreview: people besides review requesters should be able autoland (bug 1205018) r=mdoglio This removes the check for whether or not the review is mutable by the current user, which allows people other than the review requester to autoland provided they have sufficient privileges.

#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

"""Find Mercurial repositories under a specified path."""

import os
import sys

def find_hg_repos(path):
    for root, dirs, files in os.walk(path):
        for d in dirs:
            if d == '.hg':
                yield root

        dirs[:] = [d for d in dirs if d != '.hg']

if __name__ == '__main__':
    if len(sys.argv) == 1:
        print('usage: %s dir0 [dir1] ...')
        sys.exit(1)

    for d in sys.argv[1:]:
        for path in find_hg_repos(d):
            print(path[len(d):])