[Fwd: Re: [darcs-users] single user repository fails darcs check]
Dan North
dan at tastapod.com
Mon Aug 6 18:25:43 UTC 2007
Hi David.
I'm forwarding your reply to the list because it was so useful.
Thanks for your quick response. Following your suggestion I managed to
fix things so I thought I'd share. I've been editing the same project
from Windows and Linux on a dual-boot laptop. I don't know how the
pristine files would have been corrupted because they are never opened
in my IDE (I'm using Eclipse).
For the record, here's what I did:
$ darcs repair # fails with a cryptic message
$ cd _darcs/patches
$ gunzip 2007* && dos2unix 2007* && gzip 2007* # careful with the
pending file
$ cd ../..
$ darcs check # fails
$ darcs repair # fails but /now it tells me why!/
The darcs repair command produces a list of hunks it can't apply, rather
than just telling me there is a corrupt repository. So then I did this:
$ darcs repair | grep hunk | awk '{print $2}' | xargs dos2unix
i.e. fix the line endings on just the bogus files (note: I'm not
changing any files in the pristine set). Then, finally:
$darcs repair # works!
$darcs check # everything is ok
$darcs push # working again - back in business
Like I said, I'm pretty sure the IDE wouldn't have changed any
line-endings in the pristine directory (although it probably did in the
project itself) and several files were affected. I realise I'm an edge
case sharing the same project directory between Linux and Windows, but I
would feel more confident with a more platform-resilient repository format.
Still, none of this takes away from how much I like using darcs, and at
least now I have a strategy if it happens again.
Thanks again,
Dan
ps. As a quick fix, could the pristine directory be made recursively
read-only?
-------- Original Message --------
Subject: Re: [darcs-users] single user repository fails darcs check
Date: Fri, 3 Aug 2007 17:34:40 -0700
From: David Roundy <droundy at darcs.net>
To: darcs-users at darcs.net
References: <46B3B8C1.80704 at tastapod.com>
The most common cause of repository corruption is tools that recurse
through the directory tree modifying files as they go (dreamweaver is the
classic example, but automake has also been known to do this). These tools
can go into the _darcs/pristine/ directory and there modify darcs' internal
cache.
In this case, it looks like you ran a dos2unix program recursively on your
repository, which corrupted the cache. This can probably be fixed (in a
dangerous way, using a copy of the repo) by gunzipping all the patches,
running dos2unix on them all (thus purging your history of '\r') and
running darcs repair.
We have plans to some day implement a repository format that is less likely
to be corrupted by users, mostly by making the names of the files in the
pristine cache a bit more opaque.
--
David Roundy
Department of Physics
Oregon State University
_______________________________________________
darcs-users mailing list
darcs-users at darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osuosl.org/pipermail/darcs-users/attachments/20070806/f847873d/attachment.htm
More information about the darcs-users
mailing list