Creating a branch other than master using bzr-git
Eric Anderson
eric at pixelwareinc.com
Mon Dec 1 17:03:23 GMT 2008
John Arbash Meinel wrote:
> So in the end, all URL special characters are also shell special
> characters, so there isn't a great way to specify these things via
> command line.
It seems these problems stem from the fact that a URI maps directly to a
branch in bzr (this is also true in svn). Git on the other hand maps a
URI to a repository and a branch is a separate object within a
repository. So to allow bzr to interact with git (and other SCM's with
the same mapping) we need some way to specify the branch.
If bzr had the same mapping as Git then the user interface of bzr would
probably look something like:
bzr branch -b edge http://example.com/bzr.dev
This would access the branch "edge" in repository
http://example.com/bzr.dev. But since bzr does not have that mapping we
do not have an official interface for specifying the desired branch.
It would also probably NOT be good to add an official interface because
under normal bzr operation (i.e. native repositories) a "-b" flag (or
any other official interface) would make no sense and just add
confusion. So we are left with coming up with an un-official interface
for specifying branch if a SCM has the mapping git has.
My first suggestion was some sort of convention encoded in the URL. i.e.
bzr branch http://example.com/foo.git#edge
(replace # with whatever character you think has the least problems).
But as others have pointed out there doesn't seem to be many characters
that lack some sort of problem. So perhaps some other type of
un-official interface is needed. What about an environment variable? i.e.
BRANCH=edge bzr branch http://example.com/foo.git
This has the following advantages:
* It doesn't mess with the official interface any so interacting with
a normal bzr repository is not complicated in any way,
* Each plugin can determine whatever environment variables it would
like to use to help it map the concepts correctly. So since SVN
also equate a URI to a branch it would not need to support the
BRANCH environment variable. But another SCM that works like git
might use the BRANCH environment variable. i.e. each plugin could
choose whatever un-official UI made the most sense for interacting
with the foreign repository (although plugins with similar mapping
concepts should be encouraged to use similar environment variable
names for consistency).
* Avoids all encoding/escaping issues previously discussed
* Easy for a plugin to implement. bzr-git could support accessing
branches other than master on a bare repository fairly soon.
Eric
More information about the bazaar
mailing list