[darcs-users] how can I get back my patches?

David Roundy droundy at abridgegame.org
Sat Jun 26 13:12:58 UTC 2004


On Sat, Jun 26, 2004 at 02:59:06PM +0200, Roland Illig wrote:
> Hi,

Hello!

> I'm a darcs beginner. I started a repository, recorded some patches and 
> undid them all (perhaps using unpull?). Now my repository looks like this:
> 
> _darcs/inventory: (empty)
> _darcs/patches/: (my patches)
> _darcs/current/: (empty)
> 
> How can I apply my patches to the "current" directory? I'd like to have 
> my files back. :( ;)

Hmmm.  You could try

rm foo
for i in `ls -r _darcs/patches/*`; do zcat $i | head -2 >> _darcs/inventory; done
cp foo _darcs/inventory
darcs repair

This will only work if you didn't use any long comments, and if the patches
were recorded in simple chronological order and not reordered.  If there
are long comments, you'll have to extract the patch IDs manually--or use
some sort of smarter awk or sed script to extract them.

If it doesn't work (i.e. repair fails), you could try editing the resulting
inventory, to reorder the patches or to remove any extraneous patches or
duplicate patches, which could have been created if you recorded the same
change twice.

And in the future, be careful with unpull... it's dangerous! :)
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list