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, 3 Mar 2015 08:07:47 +0000 (10:07 +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 907b5909e368c0a20b9b928d1075e0a2f09713e2..752323950bffe26e5abcb7e5518a302f6ef0a59c 100755 (executable)
@@ -23,10 +23,13 @@ from six.moves 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 build_parser(name):
@@ -91,8 +94,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 993c6cba4a9134a0811463862f03d7eb51363f78..ed0de186df5293ffea90b7f9c17d7457bd93fb00 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):
     """
@@ -148,7 +151,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