/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 breezy/plugins/git/dir.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-07-03 03:20:44 UTC
  • mfrom: (7018.3.10 git-fixes)
  • Revision ID: breezy.the.bot@gmail.com-20180703032044-t5a5w5y0tmzrbezc
Port a few more bits of the git plugin to python 3.

Merged from https://code.launchpad.net/~jelmer/brz/git-fixes2/+merge/348803

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from __future__ import absolute_import
21
21
 
22
 
import urllib
23
 
 
24
22
from ... import (
25
23
    branch as _mod_branch,
26
24
    errors as bzr_errors,
30
28
    revision as _mod_revision,
31
29
    urlutils,
32
30
    )
 
31
from ...sixish import (
 
32
    PY3,
 
33
    viewitems,
 
34
    )
33
35
from ...transport import (
34
36
    do_catching_redirections,
35
37
    get_transport_from_path,
76
78
        return True
77
79
 
78
80
    def network_name(self):
79
 
        return "git"
 
81
        return b"git"
80
82
 
81
83
 
82
84
class UseExistingRepository(RepositoryAcquisitionPolicy):
221
223
            determine_wants = interrepo.determine_wants_all
222
224
        (pack_hint, _, refs) = interrepo.fetch_objects(determine_wants,
223
225
            mapping=default_mapping)
224
 
        for name, val in refs.iteritems():
 
226
        for name, val in viewitems(refs):
225
227
            target_git_repo.refs[name] = val
226
228
        result_dir = self.__class__(transport, target_git_repo, format)
227
229
        if revision_id is not None:
483
485
            try:
484
486
                branch_name = ref_to_branch_name(target_ref)
485
487
            except ValueError:
486
 
                params = {'ref': urllib.quote(target_ref, '')}
 
488
                params = {'ref': urlutils.quote(target_ref.decode('utf-8'), '')}
487
489
            else:
488
 
                if branch_name != b'':
489
 
                    params = {'branch': urllib.quote(branch_name.encode('utf-8'), '')}
 
490
                if branch_name != '':
 
491
                    params = {'branch': urlutils.quote(branch_name, '')}
490
492
                else:
491
493
                    params = {}
492
494
            try:
493
495
                base_url = urlutils.local_path_to_url(self.control_transport.get_bytes('commondir')).rstrip('/.git/')+'/'
494
496
            except bzr_errors.NoSuchFile:
495
497
                base_url = self.user_url.rstrip('/')
 
498
            if not PY3:
 
499
                params = {k: v.encode('utf-8') for (k, v) in viewitems(params)}
496
500
            return urlutils.join_segment_parameters(base_url, params)
497
501
        return None
498
502