Add some documentation to tree.go

Signed-off-by: Solomon Hykes <solomon@docker.com>
Add a small utility to simplify the test suite

Signed-off-by: Solomon Hykes <solomon@docker.com>
Add tests to reproduce bugs in DB.Get and DB.Query

Signed-off-by: Solomon Hykes <solomon@docker.com>
Fix a blind spot in the tests by only using lower-level functions

Signed-off-by: Solomon Hykes <solomon@docker.com>
Simplify TestPipelineConcat

Note: this test still fails.

Signed-off-by: Solomon Hykes <solomon@docker.com>
Tree.Repo returns the repository backing a tree

Signed-off-by: Solomon Hykes <solomon@docker.com>
Refactor pipelines and db queries/transactions

This fixes almost all known issues with pipelines, queries and
transactions. It changes the API slightly, but the result is a much more
robust implementation and API overall.

Signed-off-by: Solomon Hykes <solomon@docker.com>