Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for diff in diffs
}
# Update repo to base revision
hg_base = needed_stack[0].base_revision
if not has_revision(hg_base):
logger.warning("Missing base revision {} from Phabricator".format(hg_base))
hg_base = "tip"
if hg_base:
hg.update(rev=hg_base, clean=True)
logger.info(f"Updated repo to {hg_base}")
if self.git_repo_dir:
try:
self.git_base = vcs_map.mercurial_to_git(hg_base)
subprocess.run(
["git", "checkout", "-b", "analysis_branch", self.git_base],
check=True,
cwd=self.git_repo_dir,
)
logger.info(f"Updated git repo to {self.git_base}")
except Exception as e:
logger.info(f"Updating git repo to Mercurial {hg_base} failed: {e}")
def load_user(phid):
if phid.startswith("PHID-USER"):
return phabricator_api.load_user(user_phid=phid)
elif phid.startswith("PHID-PROJ"):
# TODO: Support group reviewers somehow.
logger.info(f"Skipping group reviewer {phid}")
else:
def mercurial_to_git(rev):
if tokenized:
return self.mercurial_to_tokenized_git[rev]
else:
return vcs_map.mercurial_to_git(rev)
def init_mapping(self):
logger.info("Downloading Mercurial <-> git mapping file...")
vcs_map.download_mapfile()
vcs_map.load_mapfile()
(
self.tokenized_git_to_mercurial,
self.mercurial_to_tokenized_git,
) = microannotate_utils.get_commit_mapping(self.tokenized_git_repo_dir)
def git_to_mercurial(rev):
if tokenized:
return self.tokenized_git_to_mercurial[rev]
else:
return vcs_map.git_to_mercurial(rev)
def init_mapping(self):
logger.info("Downloading Mercurial <-> git mapping file...")
vcs_map.download_mapfile()
vcs_map.load_mapfile()
(
self.tokenized_git_to_mercurial,
self.mercurial_to_tokenized_git,
) = microannotate_utils.get_commit_mapping(self.tokenized_git_repo_dir)