bzr-fastimport: Set branch-nick from git ref-names

Ian Clatworthy ian.clatworthy at
Thu Oct 29 08:52:04 GMT 2009

Max Bowsher wrote:
> I would like to propose that bzr-fastimport set the branch-nick of
> revisions based on the git ref-name of the imported commit (subject to
> the existing mapping that it does).
> I think this is a sufficiently sane thing to do that I would make it
> non-optional - but, it would only apply when "feature commit-properties"
> was *NOT* enabled.

Cool with me.

> Implementing this is not hard, but there are a couple of points that I'm
> not sure of the best approach:
> 1) To make this happen, I need a BranchMapper during the conversion, not
> just during the post-import branch update phase. BranchMapper is a very
> lightweight object, so I could instantiate a new one for every commit,
> but it might be better to instantiate a single one under the aegis of
> the CacheManager and access it there?

Either is ok. The latter sounds more efficient and may be better. See below.

> 2) BranchMapper has a slightly odd interface, wherein it maps a list of
> refnames to a dict of results. I would prefer to change it to expose the
>  logic to do a single mapping operation standalone - is that OK?

Yes. Just double check the current mapping doesn't depend on how other
things have already been mapped. If they do, you'll want to retain that
knowledge over the cause of an import, not per commit.

Thanks a heap for working on bzr-fastimport. IMNSHO, it's potentially a
pretty important part of the Bazaar ecosystem and I wish more people
would help enhance it. Hmm - maybe if the code quality and test coverage
was higher, they'd be more takers ...

Ian C.

More information about the bazaar mailing list