def post_diff_coverage(revision_id, coverage, phab): # See https://secure.phabricator.com/T9529 revisions = phab.post('differential.query', ids=[revision_id]) if not revisions: logger.warn("post_diff_coverage: No data for revision D%s", revision_id) return rev = revisions[0] key = 'arcanist.unit' target_map = phab.post('harbormaster.queryautotargets', objectPHID=rev['activeDiffPHID'], targetKeys=[key])['targetMap'] phid = target_map.get(key) if phid is None: logger.warn("post_diff_coverage: No target PHID for revision D%s", revision_id) return unit = [ dict(name="Coverage results from Changes for %d files" % len(coverage), result='pass', coverage=coverage) ] phab.post('harbormaster.sendmessage', buildTargetPHID=phid, type='work', unit=unit)
def post_diff_coverage(revision_id, coverage, phab): # See https://secure.phabricator.com/T9529 revisions = phab.post('differential.query', ids=[revision_id]) if not revisions: logger.warn("post_diff_coverage: No data for revision D%s", revision_id) return rev = revisions[0] key = 'arcanist.unit' target_map = phab.post('harbormaster.queryautotargets', objectPHID=rev['activeDiffPHID'], targetKeys=[key])['targetMap'] phid = target_map.get(key) if phid is None: logger.warn("post_diff_coverage: No target PHID for revision D%s", revision_id) return unit = [dict(name="Coverage results from Changes for %d files" % len(coverage), result='pass', coverage=coverage)] phab.post('harbormaster.sendmessage', buildTargetPHID=phid, type='work', unit=unit)
def commit_details(source): repo = source.repository if not repo: return None, None, None options = get_repo_options(repo.id) callsign = options.get('phabricator.callsign') default_branch = DEFAULT_BRANCHES[repo.backend] branches = source.revision.branches if not branches: branch = default_branch elif len(branches) == 1: branch = branches[0] elif default_branch in branches: branch = default_branch else: # Don't know which of several branches to choose; the default branch isn't listed. logger.warn( "commit_details: ambiguous branching (default branch %r, revision branches %r)", branch, branches) return None, None, None return callsign, branch, source.revision_sha