[darcs-users] BIG Mistake

Jorey Bump list at joreybump.com
Tue Nov 7 15:50:52 UTC 2006


Jorey Bump wrote:
> Jamie Webb wrote:
>> On Mon, Nov 06, 2006 at 12:33:58PM -0500, Jorey Bump wrote:
>>> I have a nice little repository of source code to which I added a 
>>> huge directory of binary resources. I then worked on several 
>>> revisions of the source code and decided that I didn't need the 
>>> binaries, after all. None of the source code is dependent on the 
>>> existence of the binary files in any of the revisions. Unfortunately, 
>>> this leaves me with a HUGE repository for what was once efficient 
>>> text. How can I erase all evidence of the unused directory containing 
>>> the binaries without losing my record of changes? Is there a simple 
>>> way to do this, or must I pull up to the unwanted patch and repeat 
>>> the process, copying only the desired code and recording the patches 
>>> with each step?
>>
>> If there are no dependencies, you can just 'darcs obliterate' the
>> patch in which you added the binaries. Otherwise, yes you'll need to
>> remove the depending patches too and re-record them.
> 
> I've tried this out on a test repository with the following patches:
> 
> Initial import
> Revision 1
> Revision 2
> Revision 3
> Add BIG binary directory
> Revision 4
> Revision 5
> 
> I ran this command:
> 
>  darcs obliterate -p "Add BIG binary directory"
> 
> After consuming most of my memory and swap space for over an hour (but 
> not using much CPU), it finally finished. It removed the big directory 
> from both my working copy and _darcs/current, but it didn't remove the 
> actual patch file. The patch no longer appears in changes:
> 
> Initial import
> Revision 1
> Revision 2
> Revision 3
> Revision 4
> Revision 5
> 
> Is it safe to  delete the corresponding (and huge) patch file, now?
> 
> Also, this procedure was so memory intensive, it made my workstation 
> almost unusable. I can offload the repository to another machine for 
> processing, but could I have achieved the same thing by simply deleting 
> the large patch, removing the directory from working & current, and 
> deleting the corresponding line from _darcs/inventory? Once again, we're 
> assuming there are no dependencies.

Well, to answer my own question, I tried it out, and it seemed to work:

  cd repo
  rm _darcs/patches/20061105223741-really-big-patch.gz
  rm bigdir
  rm _darcs/current/bigdir
  vim _darcs/inventory   # delete lines relating to patch
  darcs check

  Applying patch 42 of 42... done.
  The repo is consistent!

Obviously, this won't work in any case where there are dependencies, but 
I was lucky this time (or so it seems). I'm sure there a lot of nasty 
implications, but it's a nice shortcut until I get a quantum computer 
(fitting for a program allegedly having roots in quantum mechanics). :)





More information about the darcs-users mailing list