From 21522bb78d630e0575c36e83d96995c8ae625364 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 27 2015 12:16:14 +0000 Subject: Make repo.pull() raise a specific exception when there is a conflict When pulling from upstream leads to the situation where there is a conflict in the repo, repo.pull() will now raise a specific exception for this. --- diff --git a/pagure/exceptions.py b/pagure/exceptions.py index 611f25e..8927952 100644 --- a/pagure/exceptions.py +++ b/pagure/exceptions.py @@ -50,3 +50,10 @@ class PagureEvException(PagureException): ''' Exceptions used in the pagure-stream-server. ''' pass + + +class GitConflictsException(PagureException): + ''' Exception used when trying to pull on a repo and that leads to + conflicts. + ''' + pass diff --git a/pagure/lib/repo.py b/pagure/lib/repo.py index f887e97..5f83871 100644 --- a/pagure/lib/repo.py +++ b/pagure/lib/repo.py @@ -55,7 +55,7 @@ class PagureRepo(pygit2.Repository): master_ref.set_target(remote_master_id) self.head.set_target(remote_master_id) elif merge_result & pygit2.GIT_MERGE_ANALYSIS_NORMAL: - raise pagure.exceptions.PagureException( + raise pagure.exceptions.GitConflictsException( 'Pulling remote changes leads to a conflict') else: pagure.LOG.debug(