Comment 9 for bug 598174

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

colo-ify shouldn't be purging revisions, although it does make a new repository and branch the existing branch into that repository using BzrDir.sprout. The relevant code in colo-ify is:

def run(self, other_location_list=[], trunk_name='trunk'):
        the_bzrdir, relpath = bzrdir.BzrDir.open_containing(u'.')
        the_bzrdir.root_transport.mkdir(COLOCATED_LOCATION)
        repo_location = urlutils.join(the_bzrdir.root_transport.base,
                          COLOCATED_LOCATION)
        new_transport = transport.get_transport(repo_location,
            possible_transports=[the_bzrdir.root_transport])
        new_bzrdir = the_bzrdir.cloning_metadir().initialize_on_transport(
                         new_transport)
        new_repo = new_bzrdir.create_repository(shared=True)
        new_repo.set_make_working_trees(False)

        the_branch = _mod_branch.Branch.open_containing(u'.')[0]
        branch_location = urlutils.join(repo_location, trunk_name)
        new_branch_bzrdir = the_bzrdir.sprout(branch_location,
                                       source_branch=the_branch,
                                       create_tree_if_local=False)
        new_branch = new_branch_bzrdir.open_branch()
        new_branch.set_parent(None)
        self._copy_locations(the_branch, new_branch)

        reconfiguration = reconfigure.Reconfigure.to_lightweight_checkout(
                              the_bzrdir, reference_location=branch_location)
        reconfiguration.apply()

Am I misusing one of the API calls here? sprout()? It looks like BzrDir.sprout eventually runs Repository.fetch to get the revisions into the newly created repository. Could that not be pulling in all of the necessary revisions? Seems very unlikely...