[jhbuild] do not barf on wrong git branch redefinition (but display a warning)



commit 02dd17ebff1b2770b919f2579a7f1380814593fe
Author: Frederic Peters <fpeters 0d be>
Date:   Wed Apr 22 11:10:51 2009 +0200

    do not barf on wrong git branch redefinition (but display a warning)
---
 jhbuild/versioncontrol/git.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 7055b22..19829a7 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -27,6 +27,7 @@ import urlparse
 import subprocess
 import re
 import urllib
+import sys
 
 from jhbuild.errors import FatalError, CommandError
 from jhbuild.utils.cmds import get_output
@@ -75,9 +76,13 @@ class GitRepository(Repository):
             module = name
         # allow remapping of branch for module
         if name in self.config.branches:
-            new_module, revision = self.config.branches.get(name)
-            if new_module:
-                module = new_module
+            try:
+                new_module, revision = self.config.branches.get(name)
+            except (ValueError, TypeError):
+                print >> sys.stderr, _('W: ignored bad branch redefinition for module:'), name
+            else:
+                if new_module:
+                    module = new_module
         if not urlparse.urlparse(module)[0]:
             module = urlparse.urljoin(self.href, module)
         return GitBranch(self, module, subdir, checkoutdir, revision, tag)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]