[RFC] strawman explict object-tracking API
Martin Pool
mbp at sourcefrog.net
Wed Apr 18 04:34:45 BST 2007
On 4/17/07, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> Robert Collins wrote:
> For the bzr client, I can't really imagine circumstances where I'd say
> "Open a branch, and don't reuse any existing objects, please". In
> selftest, sure, but not in normal commands.
>
> I think I like Ian's suggestion of a context object better, but more, I
> would like Branch.open_containing() to DTRT without me having to
> intervene. I think wanting to avoid the cache is a lot less common than
> wanting the cache, and we should optimize the API for the our common use
> cases.
One option, which i think is what Ian is getting at, is that you would
instead do session.open_branch_containing() rather than a static
method. Then each isolated library user does need to construct one of
these when they start, but everything else would follow pretty
naturally.
I talked to Robert a bit more about this. I believe we are going to
start by having some kind of Pool object that remembers transports
that can be reused. You can pass this to get_transport, or perhaps
instead invoke get_transport on the pool.
We won't for now, make Branch/WT/Repo objects be automatically reused,
but rather have a way to detect (based on path and/or lock token)
whether two urls point to the same place.
--
Martin
More information about the bazaar
mailing list