martine/ninja — pull request #723 by ar1nd4m (2014-03-26 19:27:28+00:00)
Title: Add a new ninja tool: finddeps.

This will find and output the dependency path from one target to
another.

It uses DFS to search for nodes starting from the [from] node, and then
going up the dependency tree until it finds the first path to the [to]
node.

Due to memoization, it's not trivially possible to find all paths, and
also by definition this returns the smallest path.

A sample output when run on the ninja project is:

```
$ ninja -t finddeps ninja src/browse.cc
Path: ninja
> build/libninja.a
> build/browse.o
> src/browse.cc

$
```

I've found this very useful navigating the dependency tree in order to break dependency of one target from another.