Fix bug get changes for build

 - Increase unittests coverage for getChangesForBuild (use several codebases)
 - Fix bugs raised by the unitests.

This PR should fix trac [3099](http://trac.buildbot.net/ticket/3099) and maybe [3071](http://trac.buildbot.net/ticket/3071)
There will still be a trouble here when ``toChanges[cb]`` is None.