summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgbp-create-remote-repo9
-rwxr-xr-xgbp-pull4
-rw-r--r--gbp/command_wrappers.py10
-rw-r--r--gbp/git.py11
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)
diff --git a/gbp-pull b/gbp-pull
index 8bb9ba5..cb7d5ef 100755
--- a/gbp-pull
+++ b/gbp-pull
@@ -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"""
diff --git a/gbp/git.py b/gbp/git.py
index cb3d74b..7566635 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -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?"""