Why are you changing `toRevision` to `getBranch(build.getEnvironment(listener))`? Seems unrelated to purpose of PR.