=== modified file 'bzrlib/branch.py' --- bzrlib/branch.py 2008-06-04 05:32:23 +0000 +++ bzrlib/branch.py 2008-06-05 14:07:37 +0000 @@ -347,7 +347,7 @@ raise NotImplementedError(self.set_revision_history) def set_stacked_on(self, url): - """set the URL this branch is stacked against. + """Set the URL this branch is stacked against. :raises UnstackableBranchFormat: If the branch does not support stacking. @@ -1143,7 +1143,7 @@ raise NotImplementedError(self._branch_class) def open(self, a_bzrdir, _found=False): - """Return the branch object for a_bzrdir + """Return the branch object for a_bzrdir. _found is a private parameter, do not use it. It is used to indicate if format probing has already be done. @@ -2146,7 +2146,8 @@ source_repository = self._get_fallback_repository(old_url) for revision_id in chain([self.last_revision()], self.tags.get_reverse_tag_dict()): - self.repository.fetch(source_repository, revision_id, find_ghosts=True) + self.repository.fetch(source_repository, revision_id, + find_ghosts=True) else: self._activate_fallback_location(url) # write this out after the repository is stacked to avoid setting a @@ -2236,7 +2237,8 @@ class BzrBranch6(BzrBranch7): """See BzrBranchFormat6 for the capabilities of this branch. - This subclass of BzrBranch7 disables the new features BzrBranch7 added. + This subclass of BzrBranch7 disables the new features BzrBranch7 added, + i.e. stacking. """ def get_stacked_on(self): === modified file 'bzrlib/bzrdir.py' --- bzrlib/bzrdir.py 2008-06-03 04:33:18 +0000 +++ bzrlib/bzrdir.py 2008-06-05 14:07:37 +0000 @@ -979,7 +979,6 @@ if shallow: shallow_branch_url = self.root_transport.base else: - shallow_branch_url = None try: shallow_branch_url = source_branch.get_stacked_on() except (errors.NotStacked, errors.UnstackableBranchFormat, @@ -999,12 +998,13 @@ result_repo = result.find_repository() except errors.NoRepositoryPresent: result_repo = None - if source_repository is None and result_repo is not None: - pass - elif source_repository is None and result_repo is None: - # no repo available, make a new one - result.create_repository() - elif shallow_branch_url: + + # Create/update the result repository as required + if source_repository is None: + if result_repo is None: + # no repo available, make a new one + result.create_repository() + elif shallow_branch_url is not None: if result_repo is None: result_repo = source_repository._format.initialize(result) stacked_dir = BzrDir.open(shallow_branch_url) @@ -1014,24 +1014,28 @@ stacked_repo = stacked_dir.open_repository() result_repo.add_fallback_repository(stacked_repo) result_repo.fetch(source_repository, revision_id=revision_id) - elif source_repository is not None and result_repo is None: + elif result_repo is None: # have source, and want to make a new target repo result_repo = source_repository.sprout(result, revision_id=revision_id) else: - # fetch needed content into target. - if source_repository is not None: - # would rather do - # source_repository.copy_content_into(result_repo, - # revision_id=revision_id) - # so we can override the copy method - result_repo.fetch(source_repository, revision_id=revision_id) + # Fetch needed content into target. + # Would rather do it this way ... + # source_repository.copy_content_into(result_repo, + # revision_id=revision_id) + # so we can override the copy method + result_repo.fetch(source_repository, revision_id=revision_id) + + # Create/update the result branch if source_branch is not None: - result_branch = source_branch.sprout(result, revision_id=revision_id) + result_branch = source_branch.sprout(result, + revision_id=revision_id) else: result_branch = result.create_branch() - if shallow_branch_url: + if shallow_branch_url is not None: result_branch.set_stacked_on(shallow_branch_url) + + # Create/update the result working tree if isinstance(target_transport, LocalTransport) and ( result_repo is None or result_repo.make_working_trees()): wt = result.create_workingtree(accelerator_tree=accelerator_tree, @@ -1052,12 +1056,10 @@ basis = wt.basis_tree() basis.lock_read() subtrees = basis.iter_references() - recurse_branch = wt.branch elif source_branch is not None: basis = source_branch.basis_tree() basis.lock_read() subtrees = basis.iter_references() - recurse_branch = source_branch else: subtrees = [] basis = None @@ -1067,7 +1069,8 @@ sublocation = source_branch.reference_parent(file_id, path) sublocation.bzrdir.sprout(target, basis.get_reference_revision(file_id, path), - force_new_repo=force_new_repo, recurse=recurse) + force_new_repo=force_new_repo, recurse=recurse, + shallow=shallow) finally: if basis is not None: basis.unlock() @@ -2889,7 +2892,7 @@ ) format_registry.register_metadir('development1', 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1', - help='A branch and pack based repository that support stacking. ' + help='A branch and pack based repository that supports stacking. ' 'Please read ' 'http://doc.bazaar-vcs.org/latest/developers/development-repo.html ' 'before use.', @@ -2900,7 +2903,7 @@ ) format_registry.register_metadir('development1-subtree', 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1Subtree', - help='A branch and pack based repository that support stacking. ' + help='A branch and pack based repository that supports stacking. ' 'Please read ' 'http://doc.bazaar-vcs.org/latest/developers/development-repo.html ' 'before use.', === modified file 'bzrlib/remote.py' --- bzrlib/remote.py 2008-06-03 04:33:18 +0000 +++ bzrlib/remote.py 2008-06-05 14:07:37 +0000 @@ -1522,7 +1522,7 @@ return self._real_branch.set_parent(url) def set_stacked_on(self, stacked_location): - """set the URL this branch is stacked against. + """Set the URL this branch is stacked against. :raises UnstackableBranchFormat: If the branch does not support stacking. === modified file 'bzrlib/repository.py' --- bzrlib/repository.py 2008-06-04 07:15:45 +0000 +++ bzrlib/repository.py 2008-06-05 14:07:37 +0000 @@ -18,7 +18,6 @@ from bzrlib.lazy_import import lazy_import lazy_import(globals(), """ -from itertools import chain import re import time @@ -2783,7 +2782,7 @@ return self._walk_to_common_revisions([revision_id]) elif revision_id is not None: # Find ghosts: search for revisions pointing from one repository to - # the other, and viceversa, anywhere in the history of revision_id. + # the other, and vice versa, anywhere in the history of revision_id. graph = self.target.get_graph(other_repository=self.source) searcher = graph._make_breadth_first_searcher([revision_id]) found_ids = set()