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

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""An adapter between a Git control dir and a Bazaar ControlDir."""
19
19
 
20
 
import contextlib
 
20
from __future__ import absolute_import
21
21
 
22
22
from .. import (
23
23
    branch as _mod_branch,
 
24
    cleanup,
24
25
    errors as brz_errors,
25
26
    trace,
26
27
    osutils,
27
28
    urlutils,
28
29
    )
 
30
from ..sixish import (
 
31
    PY3,
 
32
    viewitems,
 
33
    )
29
34
from ..transport import (
30
35
    do_catching_redirections,
31
36
    get_transport_from_path,
39
44
    RepositoryAcquisitionPolicy,
40
45
    )
41
46
 
42
 
from .mapping import (
43
 
    decode_git_path,
44
 
    encode_git_path,
45
 
    )
46
47
from .push import (
47
48
    GitPushResult,
48
49
    )
191
192
        else:
192
193
            wt = None
193
194
        if recurse == 'down':
194
 
            with contextlib.ExitStack() as stack:
 
195
            with cleanup.ExitStack() as stack:
195
196
                basis = None
196
197
                if wt is not None:
197
198
                    basis = wt.basis_tree()
217
218
                        target, basis.get_reference_revision(path),
218
219
                        force_new_repo=force_new_repo, recurse=recurse,
219
220
                        stacked=stacked)
220
 
        if getattr(result_repo, '_git', None):
221
 
            # Don't leak resources:
222
 
            # TODO(jelmer): This shouldn't be git-specific, and possibly
223
 
            # just use read locks.
224
 
            result_repo._git.object_store.close()
225
221
        return result
226
222
 
227
223
    def clone_on_transport(self, transport, revision_id=None,
256
252
            determine_wants = interrepo.determine_wants_all
257
253
        (pack_hint, _, refs) = interrepo.fetch_objects(determine_wants,
258
254
                                                       mapping=default_mapping)
259
 
        for name, val in refs.items():
 
255
        for name, val in viewitems(refs):
260
256
            target_git_repo.refs[name] = val
261
257
        result_dir = LocalGitDir(transport, target_git_repo, format)
262
258
        if revision_id is not None:
546
542
                    target_branch._format, self._format)
547
543
            # TODO(jelmer): Do some consistency checking across branches..
548
544
            self.control_transport.put_bytes(
549
 
                'commondir', encode_git_path(target_path))
 
545
                'commondir', target_path.encode('utf-8'))
550
546
            # TODO(jelmer): Urgh, avoid mucking about with internals.
551
547
            self._git._commontransport = (
552
548
                target_branch.repository._git._commontransport.clone())
586
582
                base_url = self.user_url.rstrip('/')
587
583
            else:
588
584
                base_url = urlutils.local_path_to_url(
589
 
                    decode_git_path(commondir)).rstrip('/.git/') + '/'
 
585
                    commondir.decode(osutils._fs_enc)).rstrip('/.git/') + '/'
 
586
            if not PY3:
 
587
                params = {k: v.encode('utf-8') for (k, v) in viewitems(params)}
590
588
            return urlutils.join_segment_parameters(base_url, params)
591
589
        return None
592
590