use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class SvnUpdateCommand method createCommandLine.
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, ScmVersion version) {
Settings settings = SvnUtil.getSettings();
String workingDir = workingDirectory.getAbsolutePath();
if (settings.isUseCygwinPath()) {
workingDir = settings.getCygwinMountPath() + "/" + workingDir;
workingDir = StringUtils.replace(workingDir, ":", "");
workingDir = StringUtils.replace(workingDir, "\\", "/");
}
if (version != null && StringUtils.isEmpty(version.getName())) {
version = null;
}
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);
if (version == null || SvnTagBranchUtils.isRevisionSpecifier(version)) {
cl.createArg().setValue("update");
if (version != null && StringUtils.isNotEmpty(version.getName())) {
cl.createArg().setValue("-r");
cl.createArg().setValue(version.getName());
}
cl.createArg().setValue(workingDir);
} else {
if (version instanceof ScmBranch) {
// The tag specified does not appear to be numeric, so assume it refers
// to a branch/tag url and perform a switch operation rather than update
cl.createArg().setValue("switch");
if (version instanceof ScmTag) {
cl.createArg().setValue(SvnTagBranchUtils.resolveTagUrl(repository, (ScmTag) version));
} else {
cl.createArg().setValue(SvnTagBranchUtils.resolveBranchUrl(repository, (ScmBranch) version));
}
cl.createArg().setValue(workingDir);
}
}
return cl;
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class SvnTagBranchUtilsTest method testResolveUrlWithQuery.
/**
* Test SCM-379
*
* @throws Exception if any
*/
public void testResolveUrlWithQuery() throws Exception {
String url = "https://myserver/plugins/scmsvn/viewcvs.php/pom/trunk?root=myproj";
SvnScmProviderRepository repo = new SvnScmProviderRepository(url);
assertEquals("https://myserver/plugins/scmsvn/viewcvs.php/pom/trunk/tags/mytag-1?root=myproj", SvnTagBranchUtils.resolveTagUrl(repo, new ScmTag("mytag-1")));
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class GitCheckOutCommand method createPullCommand.
/**
* create a git-pull repository command
*/
private Commandline createPullCommand(GitScmProviderRepository repository, File workingDirectory, ScmVersion version) {
Commandline cl;
if (version != null && StringUtils.isNotEmpty(version.getName())) {
if (version instanceof ScmTag) {
// A tag will not be pulled but we only fetch all the commits from the upstream repo
// This is done because checking out a tag might not happen on the current branch
// but create a 'detached HEAD'.
// In fact, a tag in git may be in multiple branches. This occurs if
// you create a branch after the tag has been created
cl = GitCommandLineUtils.getBaseGitCommandLine(workingDirectory, "fetch");
cl.createArg().setValue(repository.getFetchUrl());
} else {
cl = GitCommandLineUtils.getBaseGitCommandLine(workingDirectory, "pull");
cl.createArg().setValue(repository.getFetchUrl());
cl.createArg().setValue(version.getName() + ":" + version.getName());
}
} else {
cl = GitCommandLineUtils.getBaseGitCommandLine(workingDirectory, "pull");
cl.createArg().setValue(repository.getFetchUrl());
cl.createArg().setValue("master");
}
return cl;
}
use of org.apache.maven.scm.ScmTag in project plugin-compat-tester by jenkinsci.
the class ExampleMultiParent method action.
/*
* No check implementation is required because transformedPlugins
* returns your specific list.
*/
/**
* Point to the shared location. Check if this needs to be downloaded.
*/
public Map<String, Object> action(Map<String, Object> moreInfo) throws Exception {
PluginCompatTesterConfig config = (PluginCompatTesterConfig) moreInfo.get("config");
Plugin currentPlugin = (Plugin) moreInfo.get("plugin");
// Determine if we need to run the download; only run for first identified plugin in the series
if (firstRun) {
System.out.println("Preparing for Multimodule checkout.");
// Checkout to the parent directory. All other processes will be on the child directory
File parentPath = new File(config.workDirectory.getAbsolutePath() + "/" + parentName);
System.out.println("Checking out from SCM connection URL : " + parentUrl + " (" + parentName + "-" + currentPlugin.version + ")");
ScmManager scmManager = SCMManagerFactory.getInstance().createScmManager();
ScmRepository repository = scmManager.makeScmRepository(parentUrl);
CheckOutScmResult result = scmManager.checkOut(repository, new ScmFileSet(parentPath), new ScmTag(parentName + "-" + currentPlugin.version));
if (!result.isSuccess()) {
throw new RuntimeException(result.getProviderMessage() + "||" + result.getCommandOutput());
}
}
// Checkout already happened, don't run through again
moreInfo.put("runCheckout", false);
firstRun = false;
// Change the "download"" directory; after download, it's simply used for reference
File childPath = new File(config.workDirectory.getAbsolutePath() + "/" + parentName + "/" + currentPlugin.name);
moreInfo.put("checkoutDir", childPath);
return moreInfo;
}
use of org.apache.maven.scm.ScmTag in project plugin-compat-tester by jenkinsci.
the class PluginCompatTester method cloneFromSCM.
private void cloneFromSCM(String connectionUrl, String name, String version, File checkoutDirectory) throws ComponentLookupException, ScmException {
System.out.println("Checking out from SCM connection URL : " + connectionUrl + " (" + name + "-" + version + ")");
ScmManager scmManager = SCMManagerFactory.getInstance().createScmManager();
ScmRepository repository = scmManager.makeScmRepository(connectionUrl);
CheckOutScmResult result = scmManager.checkOut(repository, new ScmFileSet(checkoutDirectory), new ScmTag(name + "-" + version));
if (!result.isSuccess()) {
throw new RuntimeException(result.getProviderMessage() + " || " + result.getCommandOutput());
}
}
Aggregations