summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Qiang <qiang.z.zhang@intel.com>2013-01-23 22:41:25 -0500
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-01-14 13:48:23 +0200
commitbdf3e72c0e83130926a45c02906a13c63a9d3d3d (patch)
tree1dc8f088ede139249a12fbe8c18bf60b4d95bbee
parent1fd6e0a6ec7bd27c96740a78000a1480f88e98eb (diff)
downloadgit-buildpackage-bdf3e72c0e83130926a45c02906a13c63a9d3d3d.tar.gz
git-buildpackage-bdf3e72c0e83130926a45c02906a13c63a9d3d3d.tar.bz2
git-buildpackage-bdf3e72c0e83130926a45c02906a13c63a9d3d3d.zip
Import RpmGitRepository if DebianGitRepository is not available
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>
-rwxr-xr-xgbp/scripts/clone.py11
-rwxr-xr-xgbp/scripts/pull.py7
2 files changed, 12 insertions, 6 deletions
diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py
index a050da90..12792986 100755
--- a/gbp/scripts/clone.py
+++ b/gbp/scripts/clone.py
@@ -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
diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py
index 2dd125c1..b3b8e4e2 100755
--- a/gbp/scripts/pull.py
+++ b/gbp/scripts/pull.py
@@ -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