Import RpmGitRepository if DebianGitRepository is not available
authorZhang Qiang <qiang.z.zhang@intel.com>
Thu, 24 Jan 2013 03:41:25 +0000 (22:41 -0500)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 7 Jan 2014 14:21:30 +0000 (16:21 +0200)
This is just a workaround, this should be fixed in nicer way by
refactoring the code.

Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
gbp/scripts/clone.py
gbp/scripts/pull.py

index a050da90a3176f1577e17e197ec3914df3bf2cfa..127929866b12113d6a69507b90766c6d3665cf5e 100755 (executable)
@@ -23,10 +23,13 @@ import ConfigParser
 import sys
 import os, os.path
 from gbp.config import (GbpOptionParser, GbpOptionGroup)
-from gbp.deb.git import DebianGitRepository
-from gbp.git import (GitRepository, GitRepositoryError)
+from gbp.git import GitRepositoryError
 from gbp.errors import GbpError
 import gbp.log
+try:
+    from gbp.deb.git import DebianGitRepository as GitRepository
+except ImportError:
+    from gbp.rpm.git import RpmGitRepository as GitRepository
 
 
 def parse_args (argv):
@@ -83,8 +86,8 @@ def main(argv):
         pass
 
     try:
-        repo = DebianGitRepository.clone(clone_to, source, options.depth,
-                                         auto_name=auto_name)
+        repo = GitRepository.clone(clone_to, source, options.depth,
+                                   auto_name=auto_name)
         os.chdir(repo.path)
 
         # Reparse the config files of the cloned repository so we pick up the
index 2dd125c1650fd60e54829735a750deb0df9d164f..b3b8e4e2692f503c6575bb61f032111cbc210905 100755 (executable)
@@ -26,8 +26,11 @@ from gbp.command_wrappers import (Command, CommandExecFailed)
 from gbp.config import (GbpOptionParser, GbpOptionGroup)
 from gbp.errors import GbpError
 from gbp.git import GitRepositoryError
-from gbp.deb.git import DebianGitRepository
 import gbp.log
+try:
+    from gbp.deb.git import DebianGitRepository as GitRepository
+except ImportError:
+    from gbp.rpm.git import RpmGitRepository as GitRepository
 
 def update_branch(branch, repo, options):
     """
@@ -138,7 +141,7 @@ def main(argv):
     gbp.log.setup(options.color, options.verbose, options.color_scheme)
 
     try:
-        repo = DebianGitRepository(os.path.curdir)
+        repo = GitRepository(os.path.curdir)
     except GitRepositoryError:
         gbp.log.err("%s is not a git repository" % (os.path.abspath('.')))
         return 1