diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-10-23 13:47:01 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-10-23 16:20:33 +0200 |
commit | db9642ba2d91bb40dcc157dd301e925d5ddedd9e (patch) | |
tree | cecc29f14eeda4da07ff263a78625a6caeaea4dd | |
parent | 240ce9ffb29fc4fbfee071eff0bfa2e7ff795fd9 (diff) |
Replace GitFetch by GitRepository.fetch()
-rwxr-xr-x | gbp-create-remote-repo | 9 | ||||
-rwxr-xr-x | gbp-pull | 4 | ||||
-rw-r--r-- | gbp/command_wrappers.py | 10 | ||||
-rw-r--r-- | gbp/git.py | 11 |
4 files changed, 17 insertions, 17 deletions
diff --git a/gbp-create-remote-repo b/gbp-create-remote-repo index 0653a9c..fa105d1 100755 --- a/gbp-create-remote-repo +++ b/gbp-create-remote-repo @@ -28,8 +28,7 @@ import subprocess import tty, termios import re import gbp.deb as du -from gbp.command_wrappers import (CommandExecFailed, PristineTar, GitCommand, - GitFetch) +from gbp.command_wrappers import (CommandExecFailed, PristineTar, GitCommand) from gbp.config import (GbpOptionParser, GbpOptionGroup) from gbp.errors import GbpError from gbp.git import (GitRepositoryError, GitRepository) @@ -131,10 +130,10 @@ def read_yn(): return False -def setup_branch_tracking(remote, branches): +def setup_branch_tracking(repo, remote, branches): gitRemoteAdd = GitCommand('remote', ['add']) gitRemoteAdd([remote['name'], remote['url']]) - GitFetch()([remote['name']]) + repo.fetch(remote['name']) gitTrackRemote = GitCommand('branch', ['--set-upstream']) for branch in branches: gitTrackRemote(['%s' % branch, '%s/%s' % (remote['name'], branch)]) @@ -231,7 +230,7 @@ echo "%(pkg)s packaging" > description push_branches(remote, branches) if options.track: - setup_branch_tracking(remote, branches) + setup_branch_tracking(repo, remote, branches) else: gbp.log.info("You can now add:") print_config(remote, branches) @@ -22,7 +22,7 @@ import sys import os, os.path -from gbp.command_wrappers import (GitFetch, Command, +from gbp.command_wrappers import (Command, CommandExecFailed, PristineTar) from gbp.config import (GbpOptionParser, GbpOptionGroup) from gbp.errors import GbpError @@ -109,7 +109,7 @@ def main(argv): gbp.log.err(out) raise GbpError - GitFetch()() + repo.fetch() for branch in branches: if not fast_forward_branch(branch, repo, options): retval = 2 diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py index 1fcfdbc..33d6823 100644 --- a/gbp/command_wrappers.py +++ b/gbp/command_wrappers.py @@ -230,16 +230,6 @@ class GitCommand(Command): self.run_error = "Couldn't run git %s" % cmd -# FIXME: move to gbp.git.fetch -class GitFetch(GitCommand): - """Wrap git fetch""" - def __init__(self, remote = None): - opts = [] - if remote: - opts += [remote] - GitCommand.__init__(self, 'fetch', opts) - - # FIXME: move to gbp.git.create_tag class GitTag(GitCommand): """Wrap git tag""" @@ -785,6 +785,17 @@ class GitRepository(object): if ret: raise GitRepositoryError, "unable to archive %s"%(treeish) + def fetch(self, repo=None): + """ + Download objects and refs from another repository. + + param repo: repository to fetch from + type repo: string + """ + if repo: + args = [repo] + + self._git_command("fetch", [ args ]) def has_submodules(self): """Does the repo have any submodules?""" |