find oldest successful build instead of just finding the oldest

If a successful build exists for a given revision, return the oldest successful build instead of just returning the oldest build.