[ANN] Bazaar Externals plugin

Óscar Fuentes ofv at wanadoo.es
Wed Nov 18 19:08:23 GMT 2009


Eugene Tarasenko <eugene.tarasenko at gmail.com> writes:

> Óscar Fuentes <ofv <at> wanadoo.es> writes:
>> For example, externals should be fetched
>> when the `update' command is executed too, because a `pull' is not
>> always possible.
>
> I add support command checkout and update in 1.0.6 version plugin.

Some random comments after experimenting a bit with the plugin.

First, a small bugfix:

as there is no guarantee that the external branch exists on the parent
container branch, this small patch is needed:

=== modified file 'externals.py'
--- externals.py	2009-11-17 08:27:44 +0000
+++ externals.py	2009-11-17 16:49:29 +0000
@@ -121,6 +121,8 @@
                 # feature branch, convert url to path
                 location = pathjoin(local_path_from_url(parent), arg[1])
                 location = self._relpath(location)
+                if not isdir(location):
+                    location = self._urljoin(parent, arg[0])
             else:
                 location = self._urljoin(parent, arg[0])
             check_legal_path(arg[1])

Now some suggestions.

As explained on my first message to this thread, I think that the parent
of external branches shall always point to the external branches of the
branched container, and only use the URL present on the `externals' file
if the parent branch has not the external. The plugin already does this
with local branches (those with an URL beginning with file:///) but IMHO
it should do that always (maybe with a option for turning that behaviour
off and forcing the use of the URL on the `externals' file). This would
consistent with the idea that a branch with externals is a cohesive
development unit, so if I get the changes on a given branch, I want to
get the changes on its externals too.

Now let's suppose you are serving a branch and its externals through
several protocols (http, bzr, sftp, etc). If the external has the
protocol hard-coded, this may be a problem. One solution is to use the
protocol used for branching the container branch, if the external URL
has a magic protocol name. So if a branch `container' has this externals
file:

same://ahost.com/repos/bzr/foo/trunk foo
http://ahost.com/repos/svn/bar/trunk

and now you branch `container this way:

bzr branch sftp://ahost.com/repos/bzr/container/trunk container

the external 'foo' would be branched with sftp too, but the external
`bar' would be branched with http.

Finally, maybe it would be useful to allow the presence of keywords on
the externals specification, for altering the behaviour of the commands
that affects it. For instance, let's suppose that we want to support the
option commented above for always branching from the URL that the
`externals' file has. We could say that by

http://somehost.com/repos/bzr/foo/trunk foo no-reparent

so the syntax of a line on `externals' would change to

URL directory [keyword ...] [revisionspec]

-- 
Óscar




More information about the bazaar mailing list