def try_to_build(series, working_dir, commit, bot): try_rmtree(working_dir) check_call(['git', 'clone', '-sn', config.get_git_dir(), working_dir]) check_call(['cp', config.get_git_dir() + '/config', working_dir + '/.git']) check_call(['git', 'checkout', commit], cwd=working_dir) check_call(['git', 'tag', 'BUILD_HEAD'], cwd=working_dir) steps = [] s, o = apply.apply_series(series, cwd=working_dir) steps.append(('apply', s, o)) if s != 0: return s, steps cmds = config.get_buildbot(bot) for step, cmd in cmds: s, o = call_teed_output(['/bin/sh', '-c', cmd], cwd=working_dir) steps.append((step, s, o)) if s != 0: return s, steps steps = map(lambda (name, s, o): (name, s, ''), steps) return 0, steps
def setup(args): maildir = config.get_notmuch_dir() git_dir = config.get_git_dir() try: os.makedirs(git_dir.rsplit('/', 1)[0]) except Exception, e: pass
def git(*args, **kwds): if 'git_dir' not in kwds: git_dir = config.get_git_dir() else: git_dir = kwds['git_dir'] if git_dir == None: git_dir = '' else: git_dir = ' --git-dir="%s"' % git_dir s, o = getstatusoutput('git%s %s' % (git_dir, ' '.join(map(lambda x: '"%s"' % x, args)))) if s != 0: raise Exception(o) return o
def get_commits(since, trees): mapping = {} git_dir = config.get_git_dir() master_branch = config.get_master_branch() for branch in trees: if branch == master_branch: refspec = branch else: refspec = '%s..%s' % (master_branch, branch) pairs = [] o = git('log', '--pretty=format:%H\n%s\n%cn\n%ce', '--since=%s' % since, refspec) lines = o.split('\n') for i in range(0, len(lines), 4): if (i + 3) >= len(lines): continue pairs.append({ 'hexsha': lines[i], 'summary': lines[i + 1], 'branch': branch, 'committer': { 'name': lines[i + 2], 'email': lines[i + 3] } }) for commit in pairs: s = commit['summary'] if mapping.has_key(s): hsh = mapping[s] if type(hsh) != list: mapping[s] = [commit] mapping[s].append(commit) else: mapping[s] = commit return mapping
def get_sha1(refspec): s, o = getstatusoutput('git --git-dir="%s" log -n 1 --format="%%H" %s' % (config.get_git_dir(), refspec)) if s != 0: raise Exception(o) return o