def clone(organization_remotes=None, remove_old_repos=False): for project in OCA_REPOSITORY_NAMES: cmd = ['git', 'clone', '--quiet', url(project), project] try: subprocess.check_call(cmd) except: cmd = [ 'git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', '--all' ] subprocess.call(cmd) if organization_remotes: for organization_remote in organization_remotes.split(','): cmd = [ 'git', '--git-dir=' + os.path.join(project, '.git'), 'remote', 'add', organization_remote, url(project, org_name=organization_remote) ] subprocess.call(cmd) cmd = [ 'git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', organization_remote ] subprocess.call(cmd) if remove_old_repos: for d in os.listdir('.'): if d not in OCA_REPOSITORY_NAMES and \ os.path.isdir(d) and \ os.path.isdir(os.path.join(d, '.git')): subprocess.check_call(['rm', '-fr', d])
def clone(organization_remotes=None, remove_old_repos=False): for project in OCA_REPOSITORY_NAMES: cmd = ['git', 'clone', '--quiet', url(project), project] try: subprocess.check_call(cmd) except: cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', '--all'] subprocess.call(cmd) if organization_remotes: for organization_remote in organization_remotes.split(','): cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'remote', 'add', organization_remote, url(project, org_name=organization_remote)] subprocess.call(cmd) cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', organization_remote] subprocess.call(cmd) if remove_old_repos: for d in os.listdir('.'): if d not in OCA_REPOSITORY_NAMES and \ os.path.isdir(d) and \ os.path.isdir(os.path.join(d, '.git')): subprocess.check_call(['rm', '-fr', d])
def get_contributions(projects, since, merges): cmd = ['git', 'log', '--pretty=format:%ai %ae'] if since is not None: cmd += ['--since', since] if merges: cmd += ['--merges'] if isinstance(projects, (str, unicode)): projects = [projects] for project in projects: contributions = {} for repo in OCA_PROJECTS[project]: if not osp.isdir(repo): status = subprocess.call(['git', 'clone', '--quiet', url(repo), repo]) if status != 0: sys.stderr.write("%s not found on github\n" % repo) continue pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=repo) out, error = pipe.communicate() for line in out.splitlines(): try: date, hour, tz, author = line.split() except ValueError: sys.stderr.write('error parsing line:\n%s\n' % line) continue contributions.setdefault(author, []).append(date) yield project, contributions
def clone(organization_remotes=None): from oca_projects import OCA_REPOSITORY_NAMES, url for project in OCA_REPOSITORY_NAMES: cmd = ['git', 'clone', '--quiet', url(project), project] try: subprocess.check_call(cmd) except: cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', '--all'] subprocess.call(cmd) if organization_remotes: for organization_remote in organization_remotes.split(','): cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'remote', 'add', organization_remote, url(project, org_name=organization_remote)] subprocess.call(cmd) cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', organization_remote] subprocess.call(cmd)
def clone(organization_remotes=None): for project in OCA_REPOSITORY_NAMES: cmd = ['git', 'clone', '--quiet', url(project), project] try: subprocess.check_call(cmd) except: cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', '--all'] subprocess.call(cmd) if organization_remotes: for organization_remote in organization_remotes.split(','): cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'remote', 'add', organization_remote, url(project, org_name=organization_remote)] subprocess.call(cmd) cmd = ['git', '--git-dir=' + os.path.join(project, '.git'), 'fetch', organization_remote] subprocess.call(cmd)