This is problematic when using darcs in scripts, as we do in our test
suite. For instance, a test i wanted to write for the rollback command gave
me strange warnings like
Warning: replace patch to f couldn't apply.
Warning: ### Error applying:
hunk ./f 2
-A
+B
### to file f:
A
B
### Reason: Hunk wants to remove content that isn't there
but when I tested the command manually I got a warning about conflicts with
unrecorded changes.
Investigating revealed that considerMergeToWorking failed to report a
conflict because it uses the index and thought that there are no unrecorded
changes. It then returned prims that cannot be applied to the actual
working state.
The short-term solution is be to make useIndex a standard option i.e. one
that is automatically supported for all commands. This solves the problem
for our test suite.
This doesn't solve the problem when using darcs in third-party scripts
unless they remember to pass --ignore-times to all commands. It works for
us only because we also set HOME, so we can freely change the defaults. So
I think we should also add a new environment variable DARCS_IGNORE_TIMES
which can be used to change the default behavior.
The long-term solution is to use high resolution timestamps for the index
and also change the index API to not require write access when we only need
the index for reading. This would eliminate the need for the --ignore-times
option, at least on file systems that support high resolution timestamps.
|