def backup_repos(self, repos): info('[%s] backing up repositories' % self.type) for repo in repos: try: repo_name = get_repo_name(repo, self.type) path = os.path.join(self.directory, repo_name) git = Git(repo, path, repo_name, self.verbose) if os.path.isdir(path): remote_refs = len(git.list_remote_refs()) if remote_refs == 0: continue git.fetch() git.reset_origin_hard() else: git.clone() except Exception: self.errors.append(repo_name)
def main(): git = Git(config.GIT_REPO, config.GIT_WORKING_COPY) git.clone()