3

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:

  1. I check which files the two patches affect using darcs changes -i and typing x for the appropriate patches.

  2. I check which files are affected by both patches.

  3. I guess which file is causing the dependency and by using darcs amend --unrecord I remove changes to this file from both patches.

  4. 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!

4

1 回答 1

1

Darcs 显示依赖关系

从 darcs 2.12(发行说明)开始,您可以使用以下命令生成依赖关系图

darcs show dependencies

关于 darcs 版本的注意事项

我建议按照发行说明中的​​说明安装带有堆栈的 darcs。


显示输出

该命令以 graphviz dot 格式生成依赖关系图。您必须自己处理显示输出(这并不奇怪)。

一种简单的方法是将输出直接通过管道传输到dot,让它创建一些输出(例如使用 png Tpng),然后将其通过管道传输到Display @ ImageMagick

darcs show dependencies --last 20 | head -n -1 | dot -Tpng | display

或者您可以将这些内容写入文件并使用 evince 或您喜欢的任何查看器打开它:

darcs show dependencies --last 20 | head -n -1 | dot -Tpdf > darcs-dependencies.pdf && xdg-open darcs-dependencies.pdf

图形界面:

我实际上已经编写了一个 gui 来自动化这个过程并进行一些颜色编码。

显示依赖对话框 彩色样本输出

你可以在这里找到它:github上的iHateDarcs

(免责声明/警告:我目前是该 gui 的唯一用户。它对我的工作流程高度定制,包括许多您可能不感兴趣的其他内容,例如与 redmine 问题跟踪器的集成,并且需要一些设置工作才能开始运行,但到目前为止还没有经过任何不是我的人的测试)

于 2017-10-12T15:07:24.453 回答