#!/usr/bin/python
# Filename:      hg-cleantree
# Purpose:       clean up a hole repository tree
# Authors:       grml-team (grml.org), (c) Michael Gebetsroither <gebi@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
################################################################################

import os

from hgutil.hg.simple import cleanupRepos
from hgutil.exception import CmdException
import hgutil.hg.util as hgutil


if __name__ == '__main__':
    dirs = (i for i in os.listdir('.') if os.path.isdir(i) and hgutil.ishgrep(i) and not hgutil.iscleaned(i))
    for i in dirs:
        try:
            cleanupRepos(i)
        except CmdException, e:
            print e

# vim: foldmethod=marker
