diff options
author | Zhang Qiang <qiang.z.zhang@intel.com> | 2013-01-23 22:41:25 -0500 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-04-03 10:11:41 +0300 |
commit | 8a2f418605a3241048555747d0e344e6edfdf095 (patch) | |
tree | cbd5cfec7c28448bf88370b87313725aae84f1f5 | |
parent | a633e70ccb21db9480a78e6e46e6b5d1960d6669 (diff) | |
download | git-buildpackage-8a2f418605a3241048555747d0e344e6edfdf095.tar.gz git-buildpackage-8a2f418605a3241048555747d0e344e6edfdf095.tar.bz2 git-buildpackage-8a2f418605a3241048555747d0e344e6edfdf095.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-x | gbp/scripts/clone.py | 9 | ||||
-rwxr-xr-x | gbp/scripts/pull.py | 7 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gbp/scripts/clone.py b/gbp/scripts/clone.py index e5988813..1ffd8315 100755 --- a/gbp/scripts/clone.py +++ b/gbp/scripts/clone.py @@ -22,10 +22,13 @@ 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): @@ -74,7 +77,7 @@ def main(argv): pass try: - repo = DebianGitRepository.clone(os.path.curdir, source, options.depth) + repo = GitRepository.clone(os.path.curdir, source, options.depth) 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 26c6ac72..b3d1b201 100755 --- a/gbp/scripts/pull.py +++ b/gbp/scripts/pull.py @@ -25,8 +25,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): """ @@ -125,7 +128,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 |