/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

Implement to_files() for git merge directives.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
from bzrlib.plugins.git.branch import (
42
42
    GitBranch,
 
43
    extract_tags,
43
44
    )
44
45
from bzrlib.plugins.git.errors import (
45
46
    GitSmartRemoteNotSupported,
54
55
from bzrlib.plugins.git.repository import (
55
56
    GitRepository,
56
57
    )
57
 
from bzrlib.plugins.git.refs import (
58
 
    extract_tags,
59
 
    branch_name_to_ref,
60
 
    )
61
58
 
62
59
import dulwich as git
63
60
from dulwich.errors import (
65
62
    )
66
63
from dulwich.pack import (
67
64
    Pack,
68
 
    ThinPackData,
 
65
    PackData,
69
66
    )
70
67
import os
71
68
import tempfile
72
69
import urllib
73
70
import urlparse
74
 
urlparse.uses_netloc.extend(['git', 'git+ssh'])
75
71
 
76
72
from dulwich.pack import load_pack_index
77
73
 
88
84
    :param url: Git URL
89
85
    :return: Tuple with host, port, username, path.
90
86
    """
91
 
    (scheme, netloc, loc, _, _) = urlparse.urlsplit(url)
92
 
    path = urllib.unquote(loc)
 
87
    (scheme, _, loc, _, _) = urlparse.urlsplit(url)
 
88
    hostport, escaped_path = urllib.splithost(loc)
 
89
    path = urllib.unquote(escaped_path)
93
90
    if path.startswith("/~"):
94
91
        path = path[1:]
95
 
    (username, hostport) = urllib.splituser(netloc)
 
92
    (username, hostport) = urllib.splituser(hostport)
96
93
    (host, port) = urllib.splitnport(hostport, None)
97
94
    return (host, port, username, path)
98
95
 
164
161
            ret = self._client
165
162
            self._client = None
166
163
            return ret
167
 
        return git.client.TCPGitClient(self._host, self._port,
168
 
            thin_packs=thin_packs, report_activity=self._report_activity)
 
164
        return git.client.TCPGitClient(self._host, self._port, thin_packs=thin_packs,
 
165
            report_activity=self._report_activity)
169
166
 
170
167
 
171
168
class SSHGitSmartTransport(GitSmartTransport):
195
192
        self._lockfiles = lockfiles
196
193
        self._mode_check_done = None
197
194
 
198
 
    def _branch_name_to_ref(self, name):
199
 
        return branch_name_to_ref(name, default="HEAD")
200
 
 
201
195
    def open_repository(self):
202
196
        return RemoteGitRepository(self, self._lockfiles)
203
197
 
204
 
    def _open_branch(self, name=None, ignore_fallbacks=False, 
 
198
    def open_branch(self, ignore_fallbacks=False, name=None,
205
199
                    unsupported=False):
206
200
        repo = self.open_repository()
207
201
        refname = self._branch_name_to_ref(name)
226
220
    @property
227
221
    def data(self):
228
222
        if self._data is None:
229
 
            self._data = ThinPackData(self.resolve_ext_ref, self._data_path)
 
223
            self._data = PackData(self._data_path)
230
224
        return self._data
231
225
 
232
226
    @property
237
231
                try:
238
232
                    def report_progress(cur, total):
239
233
                        pb.update("generating index", cur, total)
240
 
                    self.data.create_index(self._idx_path, 
 
234
                    self.data.create_index(self._idx_path, self.resolve_ext_ref,
241
235
                        progress=report_progress)
242
236
                finally:
243
237
                    pb.finished()
347
341
        if self._ref is not None:
348
342
            return self._ref
349
343
        heads = self.repository.get_refs()
350
 
        if self.name in heads:
351
 
            self._ref = heads[self.name]
352
 
        elif ("refs/heads/" + self.name) in heads:
353
 
            self._ref = heads["refs/heads/" + self.name]
354
 
        else:
 
344
        if not self.name in heads:
355
345
            raise NoSuchRef(self.name)
 
346
        self._ref = heads[self.name]
356
347
        return self._ref
357
348
 
358
349
    def _synchronize_history(self, destination, revision_id):