public BuildCommand updateTo(String baseDir, RevisionContext revisionContext) {
Revision revision = revisionContext.getLatestRevision();
String workingDir = material.workingdir(new File(baseDir)).getPath();
UrlArgument url = material.getUrlArgument();
return compose(
echoWithPrefix(format("Start updating %s at revision %s from %s", material.updatingTarget(), revision.getRevision(), url.forDisplay())),
secret(url.forCommandline(), url.forDisplay()),
secret(material.getPassword(), "*********************"),
cleanupAndUpdate(workingDir, revision).setTest(shouldDoCleanupAndUpdate(workingDir)),
freshCheckout(workingDir, revision).setTest(isNotRepository(workingDir)),
freshCheckout(workingDir, revision).setTest(test("-nd", workingDir)),
freshCheckout(workingDir, revision).setTest(repoUrlChanged(workingDir)),
echoWithPrefix(format("Done.\n"))
);
}