On 5 March 2012 16:18, Michael Hendricks <<a href="mailto:michael@ndrix.org">michael@ndrix.org</a>> wrote:<br>>Since I'm not yet familiar with Darcs' internal workings, can someone<br>>help me understand why calculating a minimal context is so expensive?<br>
<br>Because you need to do a whole bunch of commutes - working out which of *all*<br>the patches in the repository cleanly commute past a given patch.<br><br>>Is it because Darcs doesn't have quick access to patch summaries and<br>
>must load every patch, in its entirety, from disk to perform a<br>>commutation?<br><br>Yeah, I think that's pretty much it.<br><br>>If that's the reason, is it possible to store patch summaries (like<br>
>"hunk ./src/Darcs/Repository/Merge.hs 83 -1 +1") in the inventory<br>>files?  To my naive understanding, it seems that many commutations<br>>could be calculated with just those summaries.<br><br>Many, yes, but not all - you'd still sometimes need both, for example commuting a <br>
replace patch and a hunk (you'd need to know if the replace affected the hunk).<br><br>e.g. consider commuting p1 and p2, where file1 initially consists of just<br>"A" and p2 duplicates file1's line:<br>
p1 = replace file1 A B<br>p2 = hunk file1 2 +B<br><br>These commute to<br>p2' = hunk file1 2 +A<br>p1' = replace A B<br><br>But you wouldn't be able to calculate that, just knowing the summary of p2. I've <br>
attached a shell script that demonstrates that it works (unpulling the replace <br>causes the commute).<br><br>In fact, storing a "summary" is what mornfall's GSoC project did for v3<br>primitive patches, exactly so that in non-conflicting cases, we can commute<br>
hunk-patches *without* loading the entire patch, but that work isn't merged<br>into Darcs yet...<br><br>Cheers,<br>Owen.<br>