Comment 4 for bug 52976

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 52976] Re: [Bug 52976] 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:
>>> 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, copy_content_into is supposed to be a clone sort of operation that
> does an exact copy. So if it tries to copy a branch with an invalid
> parent, the result should be a branch with an invalid parent. (Because
> you may later use the branch from a location where the parent *is* valid.)
>
> e.g. copy_content_into should do
> parent = self._get_raw_parent()
> if parent:
> destination._set_raw_parent(parent)
>
> Aaron

Maybe. The issue is that if you clone from remote into local, the path
might actually need to change. Say I have:

/branch-one
/branch-two (parent is ../branch-one)
and then I clone branch-two into /sub/branch-3

/sub/branch-3 (if parent is branch-one, it needs to be
               ../../branch-one).

A raw clone would give just ../branch-one which doesn't point anywhere.

Now we could make _get_raw_parent() try to create an absolute path, and
if it fails, it just copies the raw parent over. But I do believe that
is not a whole lot better, and not worth a new api layer.

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

iD8DBQFEt9aMJdeBCYSNAAMRAn6NAJ0T1MEYpmad4xeURAmnnMoqykBJ9wCg1ohi
FTzQIIrrFSlWD38ZdPfW30g=
=0Rdn
-----END PGP SIGNATURE-----