Comment 4 for bug 465517

Revision history for this message
John A Meinel (jameinel) wrote : Re: 'bzr push' severely degraded

Looking at the code, it appears that if the bzrdir exists but there is no branch, but there *is* a repository, we end up in this code path:

        if br_to is None:
            # We have a repository but no branch, copy the revisions, and then
            # create a branch.
            repository_to.fetch(source.repository, revision_id=revision_id)
            br_to = source.clone(self, revision_id=revision_id)
            if source.get_push_location() is None or remember:
                source.set_push_location(br_to.base)
            push_result.stacked_on = None
            push_result.branch_push_result = None
            push_result.old_revno = None
            push_result.old_revid = _mod_revision.NULL_REVISION
            push_result.target_branch = br_to
            push_result.master_branch = None
            push_result.workingtree_updated = False

If we *do* have a branch we use:
                push_result.branch_push_result = source.push(br_to,
                    overwrite, stop_revision=revision_id)

This ends up going through InterBranch.push() which winds around again through '_basic_push' and seems to end up in InterBranch.update_revisions (only now having swapped source and target, so it is target.update_revisions(source)), which seems to indicate that we call
 remote_branch.fetch(local_branch, stop_revision)

(note that I'm quite horribly confused by the double indirection through InterBranch, and the fact that the default .update_revisions does this:
    def update_revisions(self, other, stop_revision=None, overwrite=False,
                         graph=None):
...
        return InterBranch.get(other, self).update_revisions(stop_revision,
            overwrite, graph)

^- Which as near as I can tell makes 'other' the self.source attribute for InterBranch, which looking at update_revisions hints that it would then be fetching "remote => local" which certainly doesn't make any sense.

And if we don't have a bzrdir we use:
            br_to = br_from.create_clone_on_transport(to_transport,
                revision_id=revision_id, stacked_on=stacked_on,
                create_prefix=create_prefix, use_existing_dir=use_existing_dir)