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>
Fri, 14 Nov 2014 12:46:23 +0000 (14:46 +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 f89cbc1cfa41be74d90e825ec30e1fd32d82f454..2810a310797d82aa901b5d0dd0995645bab60a9d 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 build_parser(name):
@@ -89,8 +92,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 f06176fd964623f3a11da470343fc1d823cab564..166955a93fc5fc6de0a2eefbbfc4af24de90aa23 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):
     """
@@ -146,7 +149,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