It would be great if the SCM would be queried for the reference build. If the builds are not in order (e.g. because the build are triggered by code review (e.g. Gerrit)), it doesn't make sense to use the last build as reference. The SCM (e.g. Git) or the Trigger (e.g. Gerrit) would know the previous commit which should be used as reference.