def is_ready_to_land(): if not fetched: git_tool.fetch([branchname, 'master']) if git_tool.is_merged_with("origin/%s" % branchname, ref="origin/master"): return None, None err = [] if not git_tool.is_merged_with("origin/master", ref="origin/%s" % branchname): err.append("Not rebased!") approvals = list(cr_tool.get_signed_comments(git_tool.get_repo(), branchname)) body = lambda x: x['body'] built = filter(compose(cr_tool.ApproveBuild.filter_message, body), approvals) cr = filter(compose(cr_tool.ApproveCR.filter_message, body), approvals) qa = filter(compose(cr_tool.ApproveQA.filter_message, body), approvals) ui = filter(compose(cr_tool.ApproveUITests.filter_message, body), approvals) probe = filter(compose(cr_tool.ApproveProbeTests.filter_message, body), approvals) ret = [] if len(built) == 0: err.append("Wasn't built!") else: ret.extend('Built by %s at %s' % (x['author']['name'], x['created_at']) for x in built) if len(cr) == 0: err.append("Wasn't reviewed!") else: ret.extend('Reviewd by %s at %s' % (x['author']['name'], x['created_at']) for x in cr) if len(qa) == 0: err.append("Didn't pass QA!") else: ret.extend("Passed QA's %s at %s" % (x['author']['name'], x['created_at']) for x in qa) if len(ui) == 0: err.append("Didn't pass UI tests!") else: ret.extend("Passed UI Tests at %s" % x['created_at'] for x in ui) if len(probe) == 0: err.append("Didn't pass Probe benchmark test") else: ret.extend("Passed Probe benchmark test at %s" % x['created_at'] for x in probe) return "\n".join(ret), (None if len(err) == 0 else "\n".join(err))
def approve(): if git_tool.is_merged_with("origin/%s" % branchname, ref="origin/master"): return None, None added = self.APPROVAL_FUNC(git_tool.get_repo(), branchname) return added, None
def close(): if git_tool.is_merged_with("origin/%s" % branchname, ref="origin/master"): return None, None closed = cr_tool.close_mr(git_tool.get_repo(), branchname) return closed, None