/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-01-12 14:46:56 UTC
  • mfrom: (7404.5.6 follow-tree-references-branch)
  • Revision ID: breezy.the.bot@gmail.com-20200112144656-vx5jxg1votqi5217
Support checking out nested trees in "bzr branch", including for git repositories.

Merged from https://code.launchpad.net/~jelmer/brz/follow-tree-references-branch/+merge/374397

Show diffs side-by-side

added added

removed removed

Lines of Context:
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,
185
186
            result.open_branch(name="").name == result_branch.name and
186
187
            isinstance(target_transport, LocalTransport) and
187
188
                (result_repo is None or result_repo.make_working_trees())):
188
 
            result.create_workingtree(
 
189
            wt = result.create_workingtree(
189
190
                accelerator_tree=accelerator_tree,
190
191
                hardlink=hardlink, from_branch=result_branch)
 
192
        else:
 
193
            wt = None
 
194
        if recurse == 'down':
 
195
            with cleanup.ExitStack() as stack:
 
196
                basis = None
 
197
                if wt is not None:
 
198
                    basis = wt.basis_tree()
 
199
                elif result_branch is not None:
 
200
                    basis = result_branch.basis_tree()
 
201
                elif source_branch is not None:
 
202
                    basis = source_branch.basis_tree()
 
203
                if basis is not None:
 
204
                    stack.enter_context(basis.lock_read())
 
205
                    subtrees = basis.iter_references()
 
206
                else:
 
207
                    subtrees = []
 
208
                for path in subtrees:
 
209
                    target = urlutils.join(url, urlutils.escape(path))
 
210
                    sublocation = source_branch.reference_parent(
 
211
                        path, possible_transports=possible_transports)
 
212
                    sublocation.controldir.sprout(
 
213
                        target, basis.get_reference_revision(path),
 
214
                        force_new_repo=force_new_repo, recurse=recurse,
 
215
                        stacked=stacked)
191
216
        return result
192
217
 
193
218
    def clone_on_transport(self, transport, revision_id=None,