We want the first PrevSuccessfullBuild, not the last one !

This is part of TRAC-3071

@delanne
I'm not sure about the logic here.

In the line below, right after the _only_ assignment to `rv` we break out of the loop.