From: Zhang Qiang Date: Thu, 24 Jan 2013 03:41:25 +0000 (-0500) Subject: Import RpmGitRepository if DebianGitRepository is not available X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db1bae68244ed687a7b62f4189b461b25a0fa2cc;p=tools%2Fgit-buildpackage.git 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 --- diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py index 907b5909..75232395 100755 --- a/gbp/scripts/clone.py +++ b/gbp/scripts/clone.py @@ -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 diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py index 993c6cba..ed0de186 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): """ @@ -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