/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:
68
68
import tempfile
69
69
import urllib
70
70
import urlparse
71
 
urlparse.uses_netloc.extend(['git', 'git+ssh'])
72
71
 
73
72
from dulwich.pack import load_pack_index
74
73
 
85
84
    :param url: Git URL
86
85
    :return: Tuple with host, port, username, path.
87
86
    """
88
 
    (scheme, netloc, loc, _, _) = urlparse.urlsplit(url)
89
 
    path = urllib.unquote(loc)
 
87
    (scheme, _, loc, _, _) = urlparse.urlsplit(url)
 
88
    hostport, escaped_path = urllib.splithost(loc)
 
89
    path = urllib.unquote(escaped_path)
90
90
    if path.startswith("/~"):
91
91
        path = path[1:]
92
 
    (username, hostport) = urllib.splituser(netloc)
 
92
    (username, hostport) = urllib.splituser(hostport)
93
93
    (host, port) = urllib.splitnport(hostport, None)
94
94
    return (host, port, username, path)
95
95
 
192
192
        self._lockfiles = lockfiles
193
193
        self._mode_check_done = None
194
194
 
195
 
    def _branch_name_to_ref(self, name):
196
 
        from bzrlib.plugins.git.branch import branch_name_to_ref
197
 
        return branch_name_to_ref(name, default="refs/heads/master")
198
 
 
199
195
    def open_repository(self):
200
196
        return RemoteGitRepository(self, self._lockfiles)
201
197
 
202
 
    def _open_branch(self, name=None, ignore_fallbacks=False, 
 
198
    def open_branch(self, ignore_fallbacks=False, name=None,
203
199
                    unsupported=False):
204
200
        repo = self.open_repository()
205
201
        refname = self._branch_name_to_ref(name)
345
341
        if self._ref is not None:
346
342
            return self._ref
347
343
        heads = self.repository.get_refs()
348
 
        if self.name in heads:
349
 
            self._ref = heads[self.name]
350
 
        elif ("refs/heads/" + self.name) in heads:
351
 
            self._ref = heads["refs/heads/" + self.name]
352
 
        else:
 
344
        if not self.name in heads:
353
345
            raise NoSuchRef(self.name)
 
346
        self._ref = heads[self.name]
354
347
        return self._ref
355
348
 
356
349
    def _synchronize_history(self, destination, revision_id):