/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to remote.py

Merge bzr-foreign.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2008 Canonical Ltd
 
1
# Copyright (C) 2007-2009 Jelmer Vernooij <jelmer@samba.org>
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
import bzrlib
18
18
from bzrlib import urlutils
19
19
from bzrlib.bzrdir import BzrDir, BzrDirFormat
20
 
from bzrlib.errors import NoSuchFile, NotLocalUrl
 
20
from bzrlib.errors import BzrError, NoSuchFile, NotLocalUrl
21
21
from bzrlib.lockable_files import TransportLock
22
22
from bzrlib.repository import Repository
23
23
from bzrlib.trace import info
38
38
import urlparse
39
39
 
40
40
import dulwich as git
 
41
from dulwich.errors import GitProtocolError
41
42
from dulwich.pack import PackData, Pack, PackIndex
42
43
 
43
44
# Don't run any tests on GitSmartTransport as it is not intended to be 
56
57
        (self._host, self._port) = urllib.splitnport(hostport, git.protocol.TCP_GIT_PORT)
57
58
        self._client = _client
58
59
 
 
60
    def has(self, relpath):
 
61
        return False
 
62
 
59
63
    def _get_client(self):
60
64
        if self._client is not None:
61
65
            ret = self._client
62
66
            self._client = None
63
67
            return ret
64
 
        return git.client.TCPGitClient(self._host, self._port, 
65
 
            capabilities=["multi_ack", "side-band-64k", "ofs-delta", "side-band"])
 
68
        return git.client.TCPGitClient(self._host, self._port, thin_packs=False)
66
69
 
67
70
    def fetch_pack(self, determine_wants, graph_walker, pack_data, progress=None):
68
71
        if progress is None:
69
72
            def progress(text):
70
73
                info("git: %s" % text)
71
 
        self._get_client().fetch_pack(self._path, determine_wants, 
72
 
            graph_walker, pack_data, progress)
 
74
        client = self._get_client()
 
75
        try:
 
76
            client.fetch_pack(self._path, determine_wants, 
 
77
                graph_walker, pack_data, progress)
 
78
        except GitProtocolError, e:
 
79
            raise BzrError(e)
73
80
 
74
81
    def get(self, path):
75
82
        raise NoSuchFile(path)