def remove(name): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.remove_repo(name) g.save() subprocess.check_call( ["sudo", "rm", "-rf", "data/repos/git/repositories/" + name + ".git"], cwd=os.getcwd())
def create_test_repo(repo_name, empty=False, ensure_new=True): if repo_name in _test_repos: if not ensure_new: return remove_test_repo(repo_name) if not os.path.isdir(wds): os.mkdir(wds) manager = Gitolite(path=os.path.join(wds, 'gitolite-admin'), url=test_settings['gitolite_url']) manager.create_repo(repo_name) manager.add_rule(repo_name, 'RW+', ['@all']) manager.save() if not empty: r = repo(wds, repo_name, clone_url='ssh://git@localhost:2222/' + repo_name, branch=None) readme = open(os.path.join(r._workdir, test_file), 'w') readme.write(test_contents) readme.close() r.stage(test_file) r.commit("Initial commit") r.push() rm('-rf', wds) _test_repos.append(repo_name)
def remove_test_repo(repo_name): if not repo_name in _test_repos: return if not os.path.isdir(wds): os.mkdir(wds) manager = Gitolite(path=os.path.join(wds, 'gitolite-admin'), url=test_settings['gitolite_url']) manager.remove_repo(repo_name) manager.save() rm('-rf', wds) _test_repos.remove(repo_name)
def remove_test_repos(): if len(_test_repos) == 0: return if not os.path.isdir(wds): os.mkdir(wds) manager = Gitolite(path=os.path.join(wds, 'gitolite-admin'), url=test_settings['gitolite_url']) for repo in set(_test_repos): manager.remove_repo(repo) manager.save() rm('-rf', wds) _test_repos.clear()
def remove(name): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.remove_user(name) g.save()
def add(name, key): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.add_user(name, key) g.save()
def add_rule(name, rule): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.add_rule_string(name, rule) g.save()
def create(name): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.create_repo(name) g.save()
def remove_user(group, name): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.remove_user_from_group(name, group) g.save()
def add_user(group, name): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.add_user_to_group(name, group) g.save()
def add(name): g = Gitolite(os.path.join(os.getcwd(), conf.gitolite_path)) g.add_group(name) g.save()