[darcs-users] duplicate patch ...
Tommy Pettersson
ptp at lysator.liu.se
Sat Jul 14 15:06:05 UTC 2007
On Sat, Jul 14, 2007 at 02:10:05AM +1000, Pietro Abate wrote:
> Migrating a cvs repo to darcs with tailor I got stuck with the same problem
> discussed here: http://lists.osuosl.org/pipermail/darcs-users/2006-December/010711.html
>
> from the thread, the consensus seems to be that this is a problem and
> that at the moment there is no way to avoid it. The thread above
> finishes also by advising the poster to fix the repo manually... I'm
> guessing un-recording/removing/re-recording...
>
> Unfortunately, my duplicate patch is the initial revision (sigh!) and
> I've 1955 patches on to of it.
>
> Is there a simple way to remove/rename one patch from the stack without
> messing up everything ?
In your case the biggest problem probably is that one of the
patches is actually missing. If two patches have the same hash
they will save their contents in the same file, and therefore
one will have over-written the other. For many operations darcs
doesn't need the patch contents -- that's why partial repos work
-- so if you're lucky darcs have never used the "wrong" patch
contents, in which case all of the other patches are ok.
If the patch is named 'init' and you do
cd _darcs/patches
zgrep -A1 '^\[init$' *.gz
you will find only one match with the right date and author, but
there should be two, one for each of the patches.
You can use 'darcs record --ask-deps --pipe' and cut'n'paste the
date and author from the output of above command, but choose a
different name (or use the same name but choose a different
date), to construct an empty patch with a new (different) hash.
Then remove the new patch entry from the inventory (but save it
in the editor's cut buffer), and replace one of the two
identical old entries (the hard part is to pick the "missing"
one) with the new entry (from the cut buffer). The inventory may
have been split into many files in _darcs/inventories/*.gz, but
the top inventory file _darcs/inventory will always contain the
new entry (the one to remove) at the end. There, now you only
have to put the missing contents into the new patch file. I
don't know how to do that. You'll have to trick tailor or
something to output the patch file but not over-write it, and
cut'n'paste everything but the two top lines (with the modified
name, author and date).
A 'darcs check --complete' will tell if it failed, and if it
didn't fail there's a good chance the repo is ok. Thing's that
will _not_ be ok is if you have used --ask-deps to depend on the
patch you replaced (likely not if it's the init patch), but you
can fix that by doing the same replace as the patch entries in
the inventory, but this time also replace the depend references.
Old checkpoints might also become invalid, but I'm not sure of
that.
All existing branches and copies of the repo will no longer work
with the fixed one!
--
Tommy Pettersson <ptp at lysator.liu.se>
More information about the darcs-users
mailing list