darcs

Patch 828 remove inventory code of optimize without --reorder flag since it did nothing

Title remove inventory code of optimize without --reorder flag since it did nothing
Superseder Nosy List gh
Related Issues
Status accepted Assigned To
Milestone

Created on 2012-05-18.22:04:26 by gh, last changed 2012-05-25.16:39:57 by mndrix.

Files
File name Status Uploaded Type Edit Remove
remove-inventory-code-of-optimize-without-__reorder-flag-since-it-did-nothing.dpatch gh, 2012-05-18.22:04:25 application/octet-stream
See mailing list archives for discussion on individual patches.
Messages
msg15705 (view) Author: gh Date: 2012-05-18.22:04:25
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
msg15706 (view) Author: darcswatch Date: 2012-05-18.22:24:33
This patch bundle (with 1 patches) was just applied to the repository http://darcs.net/screened.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_screened.html#bundle-7dbe70195c119e73b38572605b9f96d0259e8e92
msg15719 (view) Author: mndrix Date: 2012-05-25.16:39:57
Cleaner code.  Less code.  Thanks.
History
Date User Action Args
2012-05-18 22:04:26ghcreate
2012-05-18 22:06:11ghsetstatus: needs-screening -> needs-review
2012-05-18 22:24:33darcswatchsetmessages: + msg15706
2012-05-25 16:39:57mndrixsetstatus: needs-review -> accepted
messages: + msg15719