[merge][#261315][1.7] RemoteBranch sets up stacking (more) correctly

John Arbash Meinel john at arbash-meinel.com
Wed Sep 17 23:17:33 BST 2008


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

Martin Pool wrote:
> On Wed, Sep 17, 2008 at 12:08 PM, John Arbash Meinel
> <john at arbash-meinel.com> wrote:
> 

...

> I kind of see what you mean, that we want conceptually:
> 
>   switch (client.call)
>   case ok:
>      ...
>   case error:
>   case unknownmethod:
> 
> However, in actual Python I think it's better to have it inside, as
> the response variable is not actually bound unless it succeeds, so I
> like to have it right there.  Obviously either way could work.

Well, you could use an "else:" clause in case there is no error. Though both
exception handlers are just translating and raising an exception, so it is
still 'safe'.

Anyway, the reason to pull it out of the "try" code is because an exception
there will also get caught, and it looks odd to raise an exception (even one
that isn't caught) inside other exception handlers.


...

>> ^- This is a bit of a surprise. I suppose this won't really happen in
>> code that uses Branch? (As it should generally be unaware whether
>> something is stacked or not.)
> 
> Surprise that there are two rpcs?
> 
> It's always called when we open the branch.  It would be nice to do
> that as part of a more general open-the-branch call, which should
> perhaps also find the repository and get the last revision.
> 
> And if it's specifically called on the branch then we have to ask for it again.
> 
> Arguably it should be cached inside the lock context.  In practice
> this may not be a priority because it's should not often be called
> after opening the branch.  So to really get a benefit here we'd want
> to open the object locked, which would be useful in other cases, but
> requires changing the opening api.

It depends how often this needs to be called. If it is only during Branch.open
so we can poke things into the Repository, it isn't a big deal.

Also, was there a test that you can open a RemoteBranch and see it is stacked,
and that if you do "rb._ensure_real()" that the rb._real_branch is also
properly stacked?

What about if you do "rb.repository._ensure_real()" (so you aren't going
through the branch object anymore)?

John
=:->

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

iD8DBQFI0YH8JdeBCYSNAAMRApZEAJ4rPTZ4+1NPPqdtYtOfQBd5AgbcDwCeNiEO
2YzeDPklkQt7MVYCuxMyLr4=
=ijXn
-----END PGP SIGNATURE-----



More information about the bazaar mailing list