Created
August 16, 2012 08:34
-
-
Save suapapa/3368429 to your computer and use it in GitHub Desktop.
Script to generate conf file for gitolite in specific directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
def print_conf_list(project_root, project_name = ""): | |
root = os.path.realpath(project_root) | |
repositories_root = root[:root.find("repositories") + len("repositories")] | |
if not project_name: | |
project_name = root[len(repositories_root) + 1:] | |
project_name = project_name.replace("/", "_") | |
print "#root =", root | |
print "#repositories_root =", repositories_root | |
print "#project_name =", project_name | |
for b, ds, ns in os.walk(root): | |
#ds[:] = [d for d in ds if d.endswith(".git")] | |
for d in ds: | |
if d.endswith(".git"): | |
git_dir = os.path.join(b, d.rstrip(".git"))[len(repositories_root) + 1:] | |
print "@%s = %s"%(project_name, git_dir) | |
if __name__ == "__main__": | |
import sys | |
print_conf_list(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment