How to use the unidiff.UnidiffParseError function in unidiff

To help you get started, we’ve selected a few unidiff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spacepatcher / FireHOL-IP-Aggregator / app / sync.py View on Github external
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")
github bosondata / badwolf / badwolf / lint / processor.py View on Github external
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