author Gregory Szorc <>
Wed, 08 Apr 2015 15:33:48 -0700
changeset 360656 8bbac22f6b7c8fafdb86dc956ce51f9af50b2766
parent 360005 56cf093e516b7285c9c44be42ee392d54d58b62f
child 360739 93d6087733f22548da274bde27a00c1f1a4ff54a
permissions -rwxr-xr-x
deploy: implement deploy driver Ansible commands take just enough arguments that typing them all in is annoying. Let's provide a driver script for automating common deployment tasks.

#!/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

"""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] ...')

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