[darcs-devel] [patch1185] Implementing function getDeps. (and 2 more)

Alejandro Gadea bugs at darcs.net
Fri Aug 1 07:43:41 UTC 2014

New submission from Alejandro Gadea <alex.aegf at gmail.com>:

Two patchs for the command show dependencies, thoughts and a patch for the option minimize-context.

Hi everybody!

Here goes two patchs, one is the implementation of the function
that computes the dependencies and the other is the implementation
of the command "darcs show dependencies" whose output is a 
"digraph" that can be converted to pdf by doing:

$ darcs show dep | dot -Tpdf -o [FILE].pdf

Now, I take advantage of this patches for comment a couple of things
I found in the way of implement the option minimize-context for the
"darcs send". First of all, here goes some preliminary comments of
what things I assume in my implementation of the option:

1. If exist a tag, I search for dependencies in the patchs after
the tag.
2. If not exist dependencies after the tag, the only patch in the
context of the bundle to send is the tag. This is nice for helping the
command "darcs apply" to merge the patches to apply.
3. If not exist a tag, the search is made in all the repository. Here
is a more or less big assumption, that the user will use tags. Luckily,
I suppose that even the search in 700~ patches of 10~ patches to
send should have a decent performance.

So now I can pass to comment my big doubt about the way, i
understood, we want to compute the dependencies.
Here is a script that shows the fail, in fact the script makes the
repositories ready to test, one can see the bad behavior following
the mini-guide of the script file.
Link: http://hub.darcs.net/alegadea/ExamplesRepos
SH: getDepsDoesntAlwaysWork.sh

Step to comment quickly the problem:

Suppose we have two identical repositories r1, r2 with the following

m2 = m(odifying)2
m1 = m(odifying)1
a1  = a(dding)1

suppose also that r2 make a third modification m3 and want to send
a bundle to applying in r1. Another assumption is that mi con i = 1,2,3
doesnt replace lines between them, and of course all modification are
for the same file adding for a1.

First of all, if we make a bundle for send without the option minimize-
context, then the context of the bundle would be:


But now let's find out what happens if we compute the dependencies
to find out what is the context. For (1) we need to try to commute m2
with m3, which success but of course the end result is a m3' and a m2'
because the lines which modifies every one now are different, but beyond
that for our definition of dependency we can drop m2, so the final context
of the bundle with minimize-context is:


Concluding, that is a problem because now if we make darcs apply of the
"minimized bundle" the merge is made not considering m2 and the final
state of the file isn't right. For example, if we are talking about that m3
add a function in some "empty" place, this could end in m3 adding the
function in the middle of an existing function.

Finishing, I'm not sure of what is a proper solution. I mean, the way I
see it, one way can be change some things in the apply(not my favorite
choice) the other is adjust the way we think the dependencies, I was
thinking in something like "Direct Dependency" and "Indirect Dependency".
The "Direct Dependency" is a dependencie as already know it and the
"Indirect Dependency" is that if we have,

p1,p2 patches, and p1', p2' are the results of commute the patches, then
if p1 /= p1' we conclude that p1 indirectly depends of p2.

I have something almost finished of this final idea, but I'm not so sure
of a couple of things, for example:

- How to correctly compare the patches (p1 /= p1')
- In my unclean implementation I have to carry on MyEq for all over the
code and it's very ugly I think.
- Not remember now :)

Well, congratulations if you read it all :) 
Sorry for the long mail, I hope it has been clear. It would be nice some
comments for know at least if I'm not mistaken.


3 patches for repository http://darcs.net:

patch 8acd3432897864a1047d93bc8b917727482d2384
Author: Ale Gadea <alex.aegf at gmail.com>
Date:   Thu Jul 31 21:33:18 ART 2014
  * Implementing function getDeps.

patch bf2a93892dfee4d4df14808d2c9795c4310042bc
Author: Ale Gadea <alex.aegf at gmail.com>
Date:   Thu Jul 31 21:39:40 ART 2014
  * Implementation of the command "dependencies" for the supercommand "show".

patch 6a4913d393182f5d2551dcaedaff753b8bbbaf7f
Author: Ale Gadea <alex.aegf at gmail.com>
Date:   Fri Aug  1 04:21:35 ART 2014
  * Implementation of the option "minimize-context" for the command "send".

files: implementing-function-getdeps_.dpatch, patch-preview.txt, unnamed
messages: 17641
nosy: alex.aegf
status: needs-screening
title: Implementing function getDeps. (and 2 more)

Darcs bug tracker <bugs at darcs.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-preview.txt
Type: text/x-darcs-patch
Size: 21075 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20140801/0ddc1fb0/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: implementing-function-getdeps_.dpatch
Type: application/x-darcs-patch
Size: 38647 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20140801/0ddc1fb0/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unnamed
Type: application/octet-stream
Size: 5 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20140801/0ddc1fb0/attachment-0001.obj>

More information about the darcs-devel mailing list