[PATCH 1/2] Fallback the remote on 'origin'

Mathieu Bridon bochecha at fedoraproject.org
Wed Jul 16 16:18:36 UTC 2014


The name 'origin' is the default remote name with Git, so rather than
raising an exception, we should fall back on it.
---
As discussed on IRC, this is the same patch as before, with the exception
handling improved so it doesn't catch all exceptions silently, only the
ones we expect.

 src/pyrpkg/__init__.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py
index 31e516c..95ce3f2 100644
--- a/src/pyrpkg/__init__.py
+++ b/src/pyrpkg/__init__.py
@@ -285,8 +285,11 @@ class Commands(object):
         try:
             remote = self.repo.git.config('--get', 'branch.%s.remote'
                                           % self.branch_merge)
-        except git.GitCommandError, e:
-            raise rpkgError('Unable to find remote name: %s' % e)
+        except (git.GitCommandError, rpkgError) as e:
+            self.log.debug("Could not determine the remote name, falling back"
+                           " to 'origin'")
+            remote = "origin"
+
         self._branch_remote = remote
 
     @property
-- 
1.9.3



More information about the rel-eng mailing list