use of org.apache.maven.scm.ScmBranch in project maven-scm by apache.
the class SvnChangeLogCommandTest method testCommandLineWithBranchBothDates.
public void testCommandLineWithBranchBothDates() throws Exception {
Date startDate = getDate(2003, Calendar.SEPTEMBER, 10, GMT_TIME_ZONE);
Date endDate = getDate(2003, Calendar.OCTOBER, 10, GMT_TIME_ZONE);
testCommandLine("scm:svn:http://foo.com/svn/trunk", new ScmBranch("my-test-branch"), startDate, endDate, "svn --non-interactive log -v -r \"{2003-09-10 00:00:00 +0000}:{2003-10-10 00:00:00 +0000}\" http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk");
}
use of org.apache.maven.scm.ScmBranch in project maven-scm by apache.
the class SvnChangeLogCommandTest method testCommandLineWithBranchEndDateOnly.
public void testCommandLineWithBranchEndDateOnly() throws Exception {
Date endDate = getDate(2003, Calendar.OCTOBER, 10, 1, 1, 1, GMT_TIME_ZONE);
// Only specifying end date should print no dates at all
testCommandLine("scm:svn:http://foo.com/svn/trunk", new ScmBranch("my-test-branch"), null, endDate, "svn --non-interactive log -v http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk");
}
use of org.apache.maven.scm.ScmBranch in project maven-scm by apache.
the class GitUpdateCommand method createCommandLine.
/**
* create the command line for updating the current branch with the info from the foreign repository.
*/
public static Commandline createCommandLine(GitScmProviderRepository repository, File workingDirectory, ScmVersion scmVersion) {
Commandline cl = GitCommandLineUtils.getBaseGitCommandLine(workingDirectory, "pull");
cl.createArg().setLine(repository.getFetchUrl());
// now set the branch where we would like to pull from
if (scmVersion instanceof ScmBranch) {
cl.createArg().setLine(scmVersion.getName());
}
return cl;
}
use of org.apache.maven.scm.ScmBranch in project maven-scm by apache.
the class GitUpdateCommand method createLatestRevisionCommandLine.
/**
* @param scmVersion a valid branch or <code>null</code> if the master branch should be taken
* @return CommandLine for getting the latest commit on the given branch
*/
public static Commandline createLatestRevisionCommandLine(GitScmProviderRepository repository, File workingDirectory, ScmVersion scmVersion) {
Commandline cl = GitCommandLineUtils.getBaseGitCommandLine(workingDirectory, "log");
// only show exactly 1 commit
cl.createArg().setValue("-n1");
// same as --topo-order, but ensure ordering of merges
cl.createArg().setValue("--date-order");
if (scmVersion != null && scmVersion instanceof ScmBranch && scmVersion.getName() != null && scmVersion.getName().length() > 0) {
// if any branch is given, lets take em
cl.createArg().setValue(scmVersion.getName());
}
return cl;
}
use of org.apache.maven.scm.ScmBranch in project maven-plugins by apache.
the class AbstractScmPublishMojo method checkoutExisting.
protected void checkoutExisting() throws MojoExecutionException {
if (scmProvider instanceof AbstractSvnScmProvider) {
checkCreateRemoteSvnPath();
}
logInfo(MessageUtils.buffer().strong("%s") + " the pub tree from " + MessageUtils.buffer().strong("%s") + " into %s", (tryUpdate ? "Updating" : "Checking out"), pubScmUrl, checkoutDirectory);
if (checkoutDirectory.exists() && !tryUpdate) {
try {
FileUtils.deleteDirectory(checkoutDirectory);
} catch (IOException e) {
logError(e.getMessage());
throw new MojoExecutionException("Unable to remove old checkout directory: " + e.getMessage(), e);
}
}
boolean forceCheckout = false;
if (!checkoutDirectory.exists()) {
if (tryUpdate) {
logInfo("TryUpdate is configured but no local copy currently available: forcing checkout.");
}
checkoutDirectory.mkdirs();
forceCheckout = true;
}
try {
ScmFileSet fileSet = new ScmFileSet(checkoutDirectory, includes, excludes);
ScmBranch branch = (scmBranch == null) ? null : new ScmBranch(scmBranch);
ScmResult scmResult = null;
if (tryUpdate && !forceCheckout) {
scmResult = scmProvider.update(scmRepository, fileSet, branch);
} else {
int attempt = 0;
while (scmResult == null) {
try {
scmResult = scmProvider.checkOut(scmRepository, fileSet, branch);
} catch (ScmException e) {
// give it max 2 times to retry
if (attempt++ < 2) {
try {
// wait 3 seconds
Thread.sleep(3 * 1000);
} catch (InterruptedException ie) {
// noop
}
} else {
throw e;
}
}
}
}
checkScmResult(scmResult, "check out from SCM");
} catch (ScmException e) {
logError(e.getMessage());
throw new MojoExecutionException("An error occurred during the checkout process: " + e.getMessage(), e);
} catch (IOException e) {
logError(e.getMessage());
throw new MojoExecutionException("An error occurred during the checkout process: " + e.getMessage(), e);
}
}
Aggregations