[darcs-users] move vs. delete and add

Albert Reiner areiner at tph.tuwien.ac.at
Sat Mar 12 17:03:39 UTC 2005


Hi,

having used darcs now for almost a week, I have come to appreciate it
a lot.  Thanks for this good tool!  

However, one thing I have come across that seems suboptimal to me is
the following - presumably I am just not seeing the obvious:

Quite often, especially when doing literate programming or writing
papers, I have to move around entire sections, or at least sequences
of whole lines.  Consider, e.g., an old version

,----
| foo
| bar
| baz
| qux
`----

I might decide to move the unit of bar and baz to the end, yielding

,----
| foo
| qux
| bar
| baz
`----

If I record this change now with `darcs rec`, the patch - let's call
it old->new - does not reflect that I moved those two lines around but
rather that I deleted them in one place and added them in another one.

Now what happens when there is another patch, old:qux->quux, that
changes, say, the line qux in old to quux (I am talking about lines,
paragraphs, subroutines, ..., and not about token replacement here).

What happens if I want to pull the old:qux->quux patch from
(old:qux->quux . old) into new = (old->new . old), [the dot, .,
denoting patch application]?  It seems that old:qux->quux should not
commute with old->new as the latter removes lines that the former has
changed into something else, and I should get a conflict.

If, on the other hand, the old->new patch actually recorded a mere
re-ordering of lines, the commutation should succeed and I should end
up with the desired result, i.e.,

,----
| foo
| quux
| bar
| baz
`----

Such a line-move patch type would be invertible (which the related,
hypothetical line-copy patch type would not be when different copies
are modified in incompatible ways), and it would have better
commutation properties than the simple delete-and-add I currently get
with `darcs rec`: better patches through more information on the
intention of the committer.

Does such patch type exist, and if so, how can I get it?

Or else, are there any plans to add it?

Or are there other effective ways of handling this kind of situation?

Regards,

Albert.





More information about the darcs-users mailing list