[RFC] Bug 440952: "be more helpful when attempting to branch a shared repo"
Brian de Alwis
bsd at cs.ubc.ca
Thu Oct 8 21:12:02 BST 2009
Bug 440952 is based on a complaint where a user tried to branch from a
repository directory. Bzr's error message was pretty opaque: the
problem was that the location provided was a repository, not a branch.
I was recently hit a similar situation, and was sufficiently annoyed
that I thought I'd try to hack out a solution (lp:~slyguy/bzr/
bug-440952). This solution modifies BranchFormat.find_format() to try
opening the provided location as a repository having determined that
the location is not a branch. If it is a repository, the resulting
NotBranchError's extra field (now exposed from the superclass) is set
to "location is a repository"; this string is only shown to the user,
and thus preserves the calling requirements of find_format().
My approach does mean that two transport probes will now be made when
the location is not a branch. My initial approach was to modify the
relevant command definitions in builtin.py, but this requires
modifying every possible command beyond the obvious 'branch' and
'checkout', and is somewhat error-prone (when I realized I had
forgotten about 'missing'). I'm not sure what impact of changing
find_format(), but I guessed find_format() is only called a couple of
times per invocation.
Comments or suggestions?
"Amusement to an observing mind is study." - Benjamin Disraeli
More information about the bazaar