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

Aaron Bentley aaron at aaronbentley.com
Wed Aug 26 19:25:39 BST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian Clatworthy wrote:
> 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.

These ordering issues are a solved problem with TreeTransform, which
also writes to an incremental target (the filesystem!) for describing
changes in state.  When modifying the filesystem

1. we break modifications (including renames) into remove / insert pairs
2. perform all removals in child-to-parent order, giving files temporary
   names as needed.
3. perform all insertions in parent-to-child order

A system that describes "modifications" is not guaranteed to have a
direct route to the desired state.  You will sometimes have to resort to
temporary filenames.

Consider what to do about when a and b are swapped:

R a b
R b a

I don't know if this is an error, but it should be.  Trivially, the
opposite is the same problem:

R a b
R b a

The only solution in an incremental system is to use a temporary name:

R a limbo/a
R b a
R limbo/a b

What TreeTransform actually does is:
R a limbo/a
R b limbo/b
R limbo/a b
R limbo/b a

which is fully generalized.

If you'd like to chat about these issues, I'd be happy to share what
wisdom I've gained.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqVfh8ACgkQ0F+nu1YWqI0udwCfZayPV3Rb3QI98V6UFkecKt/7
j5cAn36EK5AYxJkgFC9y0kvHCaEbz5JQ
=Wslq
-----END PGP SIGNATURE-----



More information about the bazaar mailing list