I was finishing understanding and implementing the command darcs send --minimize-context using "optimize reorder" when I begin to suspect that doesn't solve the problem described in here. The thing is, despite the fact that the context in the bundle to send is reduced if before we send we make "optimize reorder", this doesn't solve the problem of dependencies. Guillaume finished of evacuate my doubts, and so after read:
- [darcs-users] darcs cannot apply some patch bundles
- issue1514 (which is the issue which "replace" issue2044 darcs send should do optimize --reorder)
I convince myself of what needs to be done, and it's calculate the "exact" dependencies of the patches to send so such dependencies be the context in the bundle to send. "Exact" because for big repositories can be very costly and calculate till certain tag seem appropriate.
Now, one concern is the cost of doing the search of dependencies. About this I can first comment some of the things I was doing during the week and later show, what I think are, encouraging examples. So first, maybe the most relevant thing of the week it's the implementation of the command darcs show dependencies with the following "description":
Usage: darcs show dependencies [OPTION]...
Generate the graph of dependencies.
--from-match=PATTERN select changes starting with a patch matching PATTERN
--from-patch=REGEXP select changes starting with a patch matching REGEXP
--from-tag=REGEXP select changes starting with a tag matching REGEXP
--last=NUMBER select the last NUMBER patches
--matches=PATTERN select patches matching PATTERN
-p REGEXP --patches=REGEXP select patches matching REGEXP
-t REGEXP --tags=REGEXP select tags matching REGEXP
--disable disable this command
-h --help shows brief description of command and its arguments
till the moment the command returns a graph described in dot language, this can eventually change. But with the current returned value one can do:
$\$$ darcs show dep | dot -Tpdf -o deps.pdf
to draw the graph in a pdf. Finally, in summary to calculate the dependencies I use more or less the idea which describes Ganesh in here.
Moving to the examples is interesting, thinking in the performance of the implementation of darcs send --minimize-context using this approach, to see the followings results:
1. Show the dependencies after the tag 2.9.9 (75 patches)
$ time darcs show dep --from-tag=2.9.9
2. Show the dependencies after the tag 2.9.8 (133 patches)
$ time darcs show dep --from-tag=2.9.8real 0m2.951s
3. Show the dependencies after the tag 2.9.7 (288 patches)
$ time darcs show dep --from-tag=2.9.7
4. Show the dependencies after the tag 2.9.6 (358 patches)
$ time darcs show dep --from-tag=2.9.6
$ time darcs show dep --from-tag=2.9.5
Rushed conclusion, seems the performance is quite good even more if we think that for compute the graph dependencies we calculate the dependencies of "all the selected patches against all the selected patches" and in the case of the option for send would only require to calculate "patches to send against all the selected patches".