[darcs-users] Replaying patches from a darcs repository

James D Sadler james at jamesdsadler.com
Sat Dec 1 14:04:12 UTC 2007


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


Hi All,

Attached is a Ruby script that can 'checkout' a darcs repository one
patch at a time
and record the changes in git.   The script does not make use of darcs
itself to perform
the checkout, and so avoids time/space issues that can occur when
using darcs directly.

Only uses this script if tailor or some other alternative fails.

* supports moves/renames
* changes to text & binaries.

limitations:

* darcs-fast-export cannot handle conflict & merger patches yet (but
that's why I am posting here, to see if anyone is smart enough to fix
up the script to handle those cases!)


I hope that some of you find this useful.  Kudos to Alan Bram for
pointing me in the right direction with the darcs patch format
handling and generally being a very nice bloke :0)


License is GPL V2.  Use at your own risk.  There no warranty, no
guarantee of fitness for a particular purpose.



Enjoy!

James.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: http://firegpg.tuxfamily.org

iD8DBQFHUWmecz568rSuSfsRAmV4AJ4mmyrUUHQiXSMBpq7dO+tUKVOS4ACfasNb
bIT/IS9Gc2uxkhP98sI9lo4=
=M1pP
-----END PGP SIGNATURE-----

On 22/11/2007, Alan Bram <alan.bram at oracle.com> wrote:
> > Essentially, what I want to be able to do is pull the repository one patch
> > at a time from first to last.
> > After each pull, I want to be able to capture the changed working tree with
> > another DVCS (probably git).
>
> I decided I wanted to do basically this same thing.  But, as you said,
> darcs did not seem to be able to do that.
>
> Here's how I solved the problem for myself:
>
> - I looked at the darcs patch files in my repo, to learn the format;
>
> - I wrote a little C program which reads a patch file, applies the
>   changes to files in an existing working-copy, and then finally
>   records (or "checks in") the changed files in another VCS.  I used
>   Subversion, so I was doing "svn commit", but I imagine it could be
>   changed to work with any other VCS.
>
> - then I made a chronological list of all the patch files in my darcs
>   repo, and fed them to my C program one at a time.  (This is easy to
>   do, since darcs names the patch files with a timestamp.)
>
> This has worked great for me, although there may be parts of the patch
> file format that I didn't discover, just because I never encountered
> them.  Basically, I wrote the C program to be as careful as possible:
> if anything at all didn't look exactly perfect, I would abort.  That
> way, when I came across something new in a patch file, I could go back
> and enhance the C program to handle the additional case.  And then
> simply try again.  The fact that Subversion uses a
> transaction-protected database engine makes it easy to abort, and
> revert, a pending change.
>
> If you wanted to try this, I could give you a copy of the C program.
>
>
> Cheers,
>  - arb
>


-- 
James Sadler
james at jamesdsadler.com | james.sadler at mootermedia.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: darcs-fast-export.rb
Type: application/x-ruby
Size: 11155 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20071202/fe7becb3/attachment.bin 


More information about the darcs-users mailing list