According to the help of optimize:
"The default optimization moves recent patches (those not included
in
the latest tag) to the `front' [..]"
Now try this:
chmod u-w _darcs/hashed_inventory
darcs optimize
darcs does not complain, while at some moment writing over the file
should fail!
Let us look at the temporary _darcs/tentative_hashed_inventory created
by
the function optimizeInventory (comment out the 'renameFile' line of
HashedRepo.tentativeFinalizeChanges). The optimization does not happen,
it's easy to verify it with a simple example with two patches and a tag
that depends only on one patch (you can do obliterate -O on the tag and
then apply it again to have the tag 'on top of' both patches in
hashed_inventory).
My conclusion is that the help messages and comments in the code are
wrong:
it's "optimize --reorder" who does what we expected all along from
optimize.
Only optimize --reorder does something useful.
So this patch kills:
Darcs.Repository.Internal.optimizeInventory
Darcs.Patch.Depends.optimizePatchSet
Darcs.Patch.Depends.deepOptimizePatchSet
And it moves the doReorder function of Darcs.Commands.Optimize into
Darcs.Repository.Internals as reorderInventory.
Also the patch cleans up the Optimize module, and --reorder now directly
calls HashedRepo.finalizeTentativeChanges instead of
finalizeRepositoryChanges.
All shell tests pass.
Attachments
|