Any plans/needs to extend the fast-import format?

Ian Clatworthy ian.clatworthy at canonical.com
Wed Aug 26 06:11:19 BST 2009


Sverre Rabbelier wrote:

>>> feature file-commands-apply-to-committed-state
>> :-)
> 
> I must not have been paying attention; what do file commands apply to currently?

They apply to the *incremental* state after previous FileCommands. Why's
that a problem? Consider the following examples ...

D b
R a b

will remove an existing file and move an existing file to the same name.
However,

R a b
D b

will do something very different. So *every* exporter needs to be very
careful about getting the ordering of these two FileCommands correct. At
first glance, putting deletes before renames is the answer. No such
luck. Consider ...

R x/y z
D x

as a set of changes. In that order, all is ok. If the delete goes first,
then things break.

Even considering renames without their interaction with
delete/add/modify/copy, things are ugly. Consider ...

R b c
R a b

Put those in the opposite order and you have a problem.

Keep in mind that Bazaar treats directories as first-class objects (they
can exist without files within them) and tracks history across renames
by using file-ids (like inodes) under the covers. The net effect is that
Bazaar repositories tend to have a larger number of renames than in many
other systems. I therefore get plenty of bugs reported about bzr
fast-export not doing the right thing in terms of producing something
git fast-import wants.

Basically, the current processing rules are a nightmare the moment
renames and copies are involved. I just happen to see it more than most!
Nevertheless, the sad reality is that *every* tool generating a
fast-import stream with renames or copies needs to be mega careful about
ordering FileCommands currently. I'm still yet to find a set of rules
for doing that ordering that always works. :-( Life would be *so* much
simplier for me, and every other fast-export developer, if the semantics
were 'vs last commit' as opposed to 'incremental'. The code in bzr
fast-import would half in complexity as well.

Ian C.



More information about the bazaar mailing list