Check db for already built commit hashes

Check the db for each commit/spec hash to see if it has already
been built. The old method of only checking against the last build
fails if the repository has multiple commits with the same commit
time(which caused delorean to keep looping over and building the
commits with the same timestamp).

Change-Id: I62ac252ee1dcb1f3efdd4b84379a00a1d7d9f95b
Merge "Check db for already built commit hashes"