I am using darcs at work for over a year now, but I keep asking myself the same question:
What is the best way to track down the code line/file/code change that is causing a dependency between two patches? For now my way of doing this is as follows:
I check which files the two patches affect using darcs changes -i
and typing x
for the appropriate patches.
I check which files are affected by both patches.
I guess which file is causing the dependency and by using darcs amend --unrecord
I remove changes to this file from both patches.
I check whether the dependency is resolved and add the changes back to the patches, while constantly checking whether the dependency reoccured or not and thereby tracking down the part of the code that is causing the dependency.
This trial and error technique of finding the code line/file that causes the dependency takes a lot of time. There must be an easier way to do this, am I missing something? Thanks in advance!
Darcs show dependencies:
starting with darcs 2.12 (release notes) you can generate a dependency graph with the command
darcs show dependencies
Note on the darcs Version
I recommend installing darcs with stack as described in the release notes.
Displaying the output
The command yields the dependency graph in the graphviz dot format. You have to take care of displaying the output yourself (no surprise there).
A simple way would be to pipe the output directly into dot
, have it create some output with (for instance a png using Tpng
) and then pipe that into Display @ ImageMagick:
darcs show dependencies --last 20 | head -n -1 | dot -Tpng | display
Or you can write the stuff into a File and open it with evince or whatever viewer you prefer:
darcs show dependencies --last 20 | head -n -1 | dot -Tpdf > darcs-dependencies.pdf && xdg-open darcs-dependencies.pdf
Graphical Interface:
I've actually written a gui that automates this process and does some color coding.
you can find it here: iHateDarcs on github
(Disclaimer/Warning: I'm currently the only user of that gui. It's highly customized to my workflow, includes lots of other stuff you might not be interested in, such as an integration with the redmine issue tracker and requires some setup work to get running, but has not been tested by anyone who isn't me as of now)