[darcs-users] unapplicable patch failure

David Roundy droundy at abridgegame.org
Tue Jul 27 12:20:27 UTC 2004

On Mon, Jul 26, 2004 at 09:30:57PM -0700, Will wrote:
> Hello,
> The following repository gives a "darcs failed: Unapplicable patch!"
> error when getting, checking, or repairing it.
>   http://www.newartisans.com/johnw/darcs/ledger2/_darcs.tar.bz2
> The failed patch just contains some code hunks, but the changed file
> is removed by a later patch.

I see the problem, but it's hard to see how it happened.  Unfortunately
it's four days older than the most recent change in the repository, so the
odds of you remembering how you triggered it (assuming it's a darcs bug)
are probably pretty slim.  :(

The problem is the

Sun Jul 18 02:44:59 EDT 2004  johnw at newartisans.com
  * add some new code, but commented it ,out

(as I'm sure you noticed).

This patch contains the following change:

hunk ./register.cc 68
-  bool          revalues = price_revalues(format.total_style);
-  unsigned int  index    = 1;
+  unsigned int  index    = 0;

which is problematic.  There are probably other problem changes in there,
but this is the one that I looked at.

A grep of all your changes for price_revalues shows that this line with
bool price_revalues only shows up in two patches, this one and a later
one.  So obviously there is a "missing" change which needs to come before
this one, in which the

  bool          revalues = price_revalues(format.total_style);

line was introduced to the file.  Somehow it seems that _darcs/current got
messed up...

Could you perhaps have hit ctrl-C or run kill during a record?  ctrl-C
*shouldn't* cause a problem, but if you killed darcs during a record (or
unrecord, etc) (or it got killed by the OOM killer or something), and it
left a lock file that you then deleted, that could explain things.
Probably any time a lock file is left over you should run a darcs check
(followed by a repair if necesary).  I'm very interested in figuring out
how this happened.

As far as what to do now to fix things, if you don't mind losing a few days
of history, the easy fix is to unrecord all the changes back to before this
patch, then run darcs repair (and darcs check to make sure the repair
worked), and then record again the changes that you unrecorded (perhaps in
one big change).
David Roundy

More information about the darcs-users mailing list