RsyncBranch?

Robert Collins robertc at robertcollins.net
Mon Jun 27 22:12:07 BST 2005


On Mon, 2005-06-27 at 13:59 -0400, Aaron Bentley wrote:
..
> So it comes down to a question of what get_url is supposed to be.
> 
> One approach would be for get_url to handle all supported protocols.
> That would be a nice, uniform interface, and it would make it easy to
> support new protocols-- you'd just need to add support in get_url.
> 
> Another approach would be for there to be multiple get_url functions.
> To create an http branch, you'd instantiate RemoteBranch with a get_url
> parameter:
> RemoteBranch(url, get_url=http_get_url)
> 
> This would allow you to make an RsyncGetUrl handler that took a
> parameter for a temporary directory.  To create an rsync branch:
> 
> RemoteBranch(url, get_url=RsyncGetUrl(temp_dir))
> 
> For that case, it's probably better to have a Transport object so we can
> stick multicopy support in the same place as get_url support.
> 
> Maybe we should just implement an object that can release resources on exit?

What about a connection object that has the base url and the protocol
embedded in it, and is used to parameterise RemoteBranch? The connection
object would work on relative urls.

def connect_remote_branch(url):
    """Connect to a remote branch and return a RemoteBranch object
    representing that connection.
    """
    # this is pseudo code, I haven't looked up the parser interface
    components=urllib.parse(url)
    if components[0] in ("http", "https"):
      connection = HttpConnection(url)
    elif components[0] in ("rsync"):
      connection = RsyncConnection(url)
    return RemoteBranch(connection)

then in RemoteBranch, you simply use relative paths for everything?

I suggest this because url is coupled to the Transport object you
suggest, so one will be forever passing url + foo to it, and url may not
vary - so Transport/Connection should take ownership of that parameter
(unless we want the Connection to be a Flyweight, but I don't think that
that applies here.)

Rob


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050628/280ed3e2/attachment.pgp 


More information about the bazaar mailing list