Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
firehol_repo = git.cmd.Git(self.repo_path)
firehol_repo.checkout("master")
firehol_repo.fetch("origin")
diff_stdout = firehol_repo.execute(["git", "diff", "master", "origin/master"], True).split("\n")
try:
udiff = unidiff.PatchSet(diff_stdout)
firehol_repo.execute(["git", "reset", "--hard", "origin/master"])
firehol_repo.merge()
self.logger.info("Successfully fetched diff from remote origin")
return udiff
except unidiff.UnidiffParseError:
self.logger.exception("UnidiffParseError occurred")
except git.GitCommandError:
self.logger.exception("GitCommandError occurred")
def load_changes(self):
try:
changes = self.pr.diff(self.context.pr_id)
except (BitbucketAPIError, UnidiffParseError):
logger.exception('Error getting pull request diff from API')
sentry.captureException()
return
self.problems.set_changes(changes)
return changes