[darcs-users] Reordering patches [was: Importing tags from subversion]

Benjamin Franksen benjamin.franksen at bessy.de
Wed Dec 13 22:29:24 UTC 2006


Tommy Pettersson wrote:
> On Tue, Dec 12, 2006 at 05:44:42PM +0100, Didier Verna wrote:
>> At some point in my patches history[1], I have this patch:
>> 
>> Tue Dec 12 14:43:08 CET 2006  didier
>>   * [project @ 126]
>>   Committed PRCS version version-1-10.1
> [...]
>> How, with Darcs, do I "get back" to that point, insert a "version 1.10"
>> tag, and return to the current state ? My problem is that currently,
>> rollback, unpulll and unrecord all sound like "shoot yourself in the
>> foot" to me ;-)
> [...]
>> Footnotes:
>> [1]  I understand that the notion of history in Darcs has no real
>> [meaning.
>> Here, it's the order in which patches were applied when converting from
>> svn.
> 
> 1) create a temporary branch with: darcs get --to-patch "^\[project
>    @ 126\]$"
> 
> 2) create the (first) tag in this temporary branch with: darcs tag
>    version-1-10.1
> 
> 3) push the (first) tag to the "master" repo with: darcs push
> 
> 4) either use 'darcs pull' to pull patches from the master repo up
>    to the next version, or remove the temporary branch and redo
>    step 1 with another --to-patch regexp.
> 
> 5) repeat from step 2
> 
> Please ask again if this is to terse or unclear.

I have been asking myself the same question as the OP. The proposed
procedure will probably work correctly in this special case, but not in
general; quote from the docs:

"These options [--from-patch etc] use the current order of patches in the
repository. darcs may reorder patches, so this is not necessarily the order
of creation or the order in which patches were applied. However, as long as
you are just recording patches in your own repository, they will remain in
order."

I guess the last sentence applies to a repo that's been freshly converted
from svn, too.

What I'd like to know: is there a general way to deliberately reorder
patches in some arbitrary darcs repo in a way that either guarantees that
they are in historical order or else fails? I can imagine to do this with a
script: extract info for all patches, sort by timestamp, then apply them in
this order to an empty repo, failing if there are any conflicts.

Would it make sense to implement such a procedure as a darcs command? Or as
an external script? Anyone maybe already done this?

Cheers
Ben





More information about the darcs-users mailing list