Comment 2 for bug 52976

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 52976] Re: [Bug 52976] bzr branch fails to set parent

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John A Meinel wrote:
>>> Public bug reported:
>>>
>>> After my changes to make the contents of '.bzr/branch/parent' be a
>>> relative path, we now have a new bug that shows up.
>>>
>>> Where when I try to branch someone else's branch, their parent may not be accessible to me.
>>> But 'bzr branch' uses 'sprout', which uses 'copy_content_into' which defaults to copying the parent over.
>
> That doesn't seem like something sprout should do.
>
> Aaron

Well, if you look at sprout, it does:

result = self._format.initialize(to_bzrdir)
self.copy_content_into(result, revision_id=revision_id)
result.set_parent(self.bzrdir.root_transport.base)
return result

So the first thing it does after the copy finishes is to overwrite the
parent.

And if you dig through clone (which had an api change, thus being
difficult to read):

result = self._format.initialize(to_bzrdir)
self.copy_content_into(result, revision_id=revision_id)
return result

copy_content_into is doing:

destination.set_revision_history(new_history)
parent = self.get_parent()
if parent:
    destination.set_parent(parent)

So one difference would be to move the 'get_parent()' call into clone()
instead of being in copy_content. However, I'm pretty sure that
'copy_content_into' has an api that says it is cloning the object.

So while I agree sprout() shouldn't be copying the parent, it is kind of
a layering issue, and I don't think it is super critical. And I think we
need to fix branch.get_parent() anyway, since it shouldn't raise a
InvalidURLJoin. It could raise a different exception rather than
returning None, but it shouldn't raise *that* exception.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEt8SdJdeBCYSNAAMRAkF9AKCxxEhOSDbw57E8jeQngBG/zkWi/ACfRkqc
crPLKHtZ4rJ80S5Xtw4CjuE=
=MtSC
-----END PGP SIGNATURE-----