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)
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)])
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)
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
gbp.log.err(out)
raise GbpError
- GitFetch()()
+ repo.fetch()
for branch in branches:
if not fast_forward_branch(branch, repo, options):
retval = 2
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"""
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?"""