[RFC] Repository copies

Jelmer Vernooij jelmer at samba.org
Tue Dec 19 20:25:44 GMT 2006


On Tue, 2006-12-19 at 12:28 -0600, John Arbash Meinel wrote:
> Jelmer Vernooij wrote:> 
> > Any thoughts on adding Repository.find_branches() ?
> One of our general statements to this point is that Repository is just a
> storage optimization. It isn't strictly required. Sometimes I wonder if
> we want to keep that statement, but that is our current policy.
> 
> Which means that a function like this should not be hung off of Repository.
> 
> It should be a generic function that finds branches that are underneath
> a given path. For example it could be something like:
> 
> def find_branches_beneath(base_transport):
>     """Search for any possible branches underneath the base."""
> 
> Now I realize this probably conflicts a little bit with what you are
> looking for. Because an SVN Repository would implement this very
> differently.
Yeah, the problem with that is that it's still polling - i.e., walking over all files in the repository recursively and checking whether they are a branch. 
That's very slow for bzr-svn, whereas I can also generate the list of
branches myself very quickly. Asking for a list of branches isn't
appropriate for Transport though, so I wonder what places it /does/
belong. 

> And I'm not sure how git or hg would handle these. git has multiple
> branches per working tree + repository pair, monotone has a repository
> with multiple branches and each branch can have multiple heads. svn
> doesn't really have branches as a real object, though it simulates it
> with a naming convention.
> 
> So I'm trying to reconcile how we see the world with how other tools
> might see the world, and what functionality we would like to see.

I think there two ways of looking at repositories:

 * As a basket to store revisions so they don't have to be stored in
multiple places.

 * As a set of related branches. In this case, it's more important to
know (for the user) what repository a branch is in.

> So for bzr, this would be better expressed as a 'branch --recursive'
> sort of command. Which would copy everything underneath a given url.

> Now, that may not be the best mental representation for users.
> Certainly, something like 'bzr mirror-repository REMOTE LOCAL' has a
> nice mental understanding, or 'copy-repository'.
Yeah, it implies that a branch is being copied recursively rather than a
set of branches. It also doesn't imply that a repository is being
created for those branches. I like "bzr mirror-repository" much better. 

One of the main problems is that the function I'm looking for would have
to have knowledge about all paths underneath the path that's being
searched. I.e. Repository.open("foo").find_branches() would have to know
how to find all branches underneath "foo". 

Cheers,

Jelmer
-- 
Jelmer Vernooij <jelmer at samba.org> - http://samba.org/~jelmer/





More information about the bazaar mailing list