dag: add missing unit test for DAG.AddManyParents()
dag: make it so Nodes know their own ID

This is the start of detaching build.go from its overly intimate
relationship with the DAG. I want that code to move to a separate
package, and that means it should only interact with DAG and Node, and
not know anything about node IDs.

The cost is that DAG.Rebuild() is now a destructive operation: it has
to detach nodes from the old DAG by setting their ID to -1, and then
it trashes the old DAG since it's no longer coherent.

Added DAG.verify() and DAG.copy() methods to help test code.
dag: get rid of DAG.lookupId() method

No longer necessary now that we can just call node.id().
dag: add Nodes(), HasParents() methods to DAG

This eliminates another place where BuildState -- or rather, its unit
test -- has direct knowledge of DAG internals.
dag: don't expose node ID to BuildState

This takes care of the worst of the coupling between BuildState and
DAG, so we can move BuildState to a new package.
dag: make methods Lookup(), ParentNodes() public

They'll be needed to move build.go to a new 'build' package.
dag: make StubRule public in preparation for factoring out fubsy/build package
dag: make TestDAG public, so it can be used from other packages' tests
build: factor new package out of dag

Now runtime depends on build and dag, and build depends on dag. dag
depends only on types, which is good: it's back to being (almost) pure
data structure, without too much in the way of decision-making or I/O.
(Various Node types will still have to do I/O in order to implement
Exists() and Changed(), though.)
dag: add MakeNodeSet() method, so build package does not know about bitsets
dag: make it possible to define methods of NodeSet

On the surface this is simple: make NodeSet an alias for bit.Set
rather than *bit.Set. Of course it was a little more complex than
that, since it required every use of NodeSet to become *NodeSet
instead. But the upside is that other packages are now shielded a
little bit more from *bit.Set, and the dag package hides behind the
NodeSet abstraction a little more.

Also added the first method of NodeSet: String(). This replaces
setToString() in dag_test.go.
build: convert some commented-out debug output to use log package

Also add NodeSet.Length() method.
build: add unit tests for some incremental build cases
build: misc cosmetics, comments, minor rename
dag: change StubNode so Changed() defaults to false
build: add a test case for a full build where all targets are missing

This is much more realistic than the existing "all targets have
changed" test. That'll only happen in real life when someone deletes
the database, but "all missing" will happen every time someone does a
build in a fresh working dir.
build: make changestates a member of BuildState instead of passing it around