本文整理汇总了Java中org.apache.maven.scm.ScmFileSet类的典型用法代码示例。如果您正苦于以下问题:Java ScmFileSet类的具体用法?Java ScmFileSet怎么用?Java ScmFileSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScmFileSet类属于org.apache.maven.scm包,在下文中一共展示了ScmFileSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: delete
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* Schedules directories and files for deletion from version control upon the next
* commit (locally). Like 'svn delete PATH' command. It's done by invoking
* <p/>
* SVNWCClient.doDelete(File path, boolean force, boolean dryRun)
* <p/>
* which takes the following parameters:
* <p/>
* path - an entry to be scheduled for deletion;
* <p/>
* force - a boolean flag which is set to true to force a deletion even if an entry
* has local modifications;
* <p/>
* dryRun - set to true not to delete an entry but to check if it can be deleted;
* if false - then it's a deletion itself.
*/
public static void delete( SVNClientManager clientManager, ScmFileSet fileSet, boolean force )
throws SVNException
{
if ( fileSet.getFileList() == null || fileSet.getFileList().isEmpty() )
{
return;
}
for ( File file : fileSet.getFileList() )
{
if ( !file.isAbsolute() )
{
file = new File( fileSet.getBasedir().getAbsolutePath(), file.getPath() );
}
clientManager.getWCClient().doDelete( file, force, false );
}
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:33,代码来源:SvnJavaUtil.java
示例2: executeStatusCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet )
throws ScmException
{
if ( getLogger().isInfoEnabled() )
{
getLogger().info( "SVN status directory: " + fileSet.getBasedir().getAbsolutePath() );
}
SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;
SvnStatusHandler handler = new SvnStatusHandler( fileSet.getBasedir() );
try
{
SvnJavaUtil.status( javaRepo.getClientManager(), fileSet.getBasedir(), true, // isRecursive
true, // isRemote
handler );
return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
}
catch ( SVNException e )
{
return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN status failed.", e.getMessage(), false );
}
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:29,代码来源:SvnJavaStatusCommand.java
示例3: executeBlameCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* @see org.apache.maven.scm.command.blame.AbstractBlameCommand#executeBlameCommand(org.apache.maven.scm.provider.ScmProviderRepository,
* org.apache.maven.scm.ScmFileSet, java.lang.String)
*/
@Override
public BlameScmResult executeBlameCommand( ScmProviderRepository repo, ScmFileSet workingDirectory,
String filename )
throws ScmException
{
try
{
SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;
javaRepo.getClientManager();
AnnotationHandler handler = new AnnotationHandler();
SvnJavaUtil.blame( javaRepo.getClientManager(), new File( workingDirectory.getBasedir(), filename ),
handler );
return new BlameScmResult( "", handler.lines );
}
catch ( SVNException e )
{
throw new ScmException( e.getMessage(), e );
}
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:24,代码来源:SvnJavaBlameCommand.java
示例4: prepareCopy
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
public void prepareCopy()
throws Exception
{
if (checkoutPath.toFile().exists()){
return;
}
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = System.getProperty( "svnUrl" );
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
provider.checkOut( scmManager.makeScmRepository( scmUrl ), //
new ScmFileSet( checkoutPath.toFile() ) );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:18,代码来源:SvnScmProviderRepositoryTest.java
示例5: testInfo
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
@Test
public void testInfo()
throws Exception
{
prepareCopy();
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = System.getProperty( "scmUrlProject" );
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProviderRepository repository =
new SvnJavaScmProviderRepository( SVNURL.parseURIEncoded( url ), scmUrl );
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
InfoScmResult result = provider.info( repository, new ScmFileSet( checkoutPath.toFile() ), null );
InfoItem item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
SvnJavaInfoCommand command = new SvnJavaInfoCommand();
ScmLogger logger = new DefaultLog();
command.setLogger(logger);
result = command.executeInfoCommand( repository, new ScmFileSet( checkoutPath.toFile() ), null, true, null );
item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
System.out.println( item.getRevision() );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:27,代码来源:SvnJavaInfoCommandTest.java
示例6: testInfoLocale
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
public void testInfoLocale()
throws Exception
{
prepareCopy();
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = getBasedir();
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProviderRepository repository =
new SvnJavaScmProviderRepository( SVNURL.fromFile( checkoutPath.toFile() ), scmUrl );
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
InfoScmResult result = provider.info( repository, new ScmFileSet( checkoutPath.toFile() ), null );
InfoItem item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
SvnJavaInfoCommand command = new SvnJavaInfoCommand();
ScmLogger logger = new DefaultLog();
command.setLogger(logger);
result = command.executeInfoCommand( repository, new ScmFileSet( checkoutPath.toFile() ), null, true, null );
item = result.getInfoItems().get( 0 );
assertTrue( item.getRevision() != null );
System.out.println( item.getRevision() );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:26,代码来源:SvnJavaInfoCommandTest.java
示例7: resolveBranchOrExpression
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* Given the ScmManager for the current execution cycle, and the MavenProject structure, determine if we can
* find a maven-provided manner of resolving the current git branch.
*
* @param scmManager The current maven ScmManager
* @param project The Current maven Project
* @param log A Log to write to
* @return The current git branch name, or <code>${env.GIT_BRACH}</code> if the current git branch could not be resolved.
* @throws ScmException
*/
public static String resolveBranchOrExpression(final ScmManager scmManager, final MavenProject project, final Log log) {
String connectionUrl = resolveUrlOrExpression(project, log);
// If a connectionURL other than the default expression was resolved, try to resolve the branch.
if (!StringUtils.equals(connectionUrl, DEFAULT_URL_EXPRESSION)) {
try {
ScmRepository repository = scmManager.makeScmRepository(connectionUrl);
ScmProvider provider = scmManager.getProviderByRepository(repository);
if (GitScmProviderRepository.PROTOCOL_GIT.equals(provider.getScmType())) {
ScmFileSet fileSet = new ScmFileSet(project.getBasedir());
return GitBranchCommand.getCurrentBranch(new ScmLogDispatcher(), (GitScmProviderRepository) repository.getProviderRepository(), fileSet);
} else {
log.warn("Project SCM defines a non-git SCM provider. Falling back to variable resolution.");
}
} catch (ScmException se) {
log.warn("Unable to resolve Git Branch from Project SCM definition.", se);
}
}
log.debug("Git branch unresolvable from Project SCM definition, defaulting to " + DEFAULT_BRANCH_EXPRESSION);
return DEFAULT_BRANCH_EXPRESSION;
}
开发者ID:egineering-llc,项目名称:gitflow-helper-maven-plugin,代码行数:34,代码来源:ScmUtils.java
示例8: info
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* Get info from scm.
*
* @param repository
* @param fileSet
* @return
* @throws ScmException
* @todo this should be rolled into org.apache.maven.scm.provider.ScmProvider and
* org.apache.maven.scm.provider.svn.SvnScmProvider
*/
protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet )
throws ScmException
{
CommandParameters commandParameters = new CommandParameters();
// only for Git, we will make a test for shortRevisionLength parameter
if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() )
&& this.shortRevisionLength > 0 )
{
getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." );
if ( shortRevisionLength >= 0 && shortRevisionLength < 4 )
{
getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " );
}
commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength );
}
if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) )
{
commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) );
}
return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet,
commandParameters );
}
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:36,代码来源:AbstractScmMojo.java
示例9: execute
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
private ScmResultWrapper execute(final ScmFileSet fileSet,
final ScmRepository repository, final ScmProvider provider)
throws org.apache.maven.scm.ScmException
{
final ScmVersion remoteVersion = scmConnectionInfo.getRemoteVersion();
final ScmResultWrapper result;
if (remoteVersion != null)
{
final ScmVersion localVersion = null;
result =
createScmDiffResultWrapper(provider.diff(repository, fileSet,
remoteVersion, localVersion));
}
else
{
result =
createScmStatusResultWrapper(provider.status(repository, fileSet));
}
return result;
}
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:21,代码来源:MavenScmRevisionNumberFetcher.java
示例10: cloneRepository
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
public CheckOutScmResult cloneRepository(String scmUrl, String revision, String cloneTo) throws ScmException {
File buildDir = new File(cloneTo);
if (!buildDir.exists())
buildDir.mkdir();
ScmRepository repo = getScmRepository(String.format("scm:%s:%s", repositoryType.name(), scmUrl), scmManager);
return scmManager.checkOut(repo, new ScmFileSet(buildDir), new ScmTag(revision));
}
开发者ID:ahmedlawi92,项目名称:pnc-local,代码行数:10,代码来源:ScmRetriever.java
示例11: remoteInfo
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
@Override
public RemoteInfoScmResult remoteInfo( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
return new SvnJavaRemoteInfoCommand().executeRemoteInfoCommand( repository, fileSet, parameters );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:8,代码来源:SvnJavaScmProvider.java
示例12: executeCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
@Override
public ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
boolean recursive = parameters == null ? false : parameters.getBoolean( CommandParameter.RECURSIVE );
ScmVersion scmVersion =
parameters == null ? null : parameters.getScmVersion( CommandParameter.SCM_VERSION, null );
return executeListCommand( repository, fileSet, recursive, scmVersion );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:11,代码来源:SvnJavaListCommand.java
示例13: executeMkdirCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* @see org.apache.maven.scm.command.mkdir.AbstractMkdirCommand#executeMkdirCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, java.lang.String)
*/
@Override
protected MkdirScmResult executeMkdirCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
boolean createInLocal )
throws ScmException
{
SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;
Iterator<File> it = fileSet.getFileList().iterator();
String dirPath = it.next().getPath();
// replacing \ with / for windauze
if ( dirPath != null && Os.isFamily( Os.FAMILY_DOS ) )
{
dirPath = StringUtils.replace( dirPath, "\\", "/" );
}
String url = javaRepo.getUrl() + "/" + dirPath;
if ( createInLocal )
{
url = dirPath;
}
List<SVNURL> svnurls = new ArrayList<SVNURL>( 1 );
try
{
svnurls.add( SVNURL.parseURIEncoded( url ) );
SVNCommitInfo commitInfo =
SvnJavaUtil.mkdir( javaRepo.getClientManager(), svnurls.toArray( new SVNURL[svnurls.size()] ),
message );
ScmResult scmResult = new ScmResult( null, null, null, true );
return new MkdirScmResult( Long.toString( commitInfo.getNewRevision() ), scmResult );
}
catch ( SVNException e )
{
throw new ScmException( e.getMessage(), e );
}
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:39,代码来源:SvnJavaMkdirCommand.java
示例14: executeAddCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected ScmResult executeAddCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
boolean binary )
throws ScmException
{
CommandParameters commandParameters = new CommandParameters();
commandParameters.setString( CommandParameter.MESSAGE, message );
return executeCommand( repository, fileSet, commandParameters );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:12,代码来源:SvnJavaAddCommand.java
示例15: executeChangeLogCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet,
ScmVersion startVersion, ScmVersion endVersion,
String datePattern )
throws ScmException
{
throw new UnsupportedOperationException( "executeChangeLogCommand( ScmProviderRepository repository, "
+ "ScmFileSet fileSet, ScmVersion startVersion, ScmVersion endVersion, String datePattern ) is not "
+ "implemented" );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:13,代码来源:SvnJavaChangeLogCommand.java
示例16: executeRemoveCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected ScmResult executeRemoveCommand( ScmProviderRepository repo, ScmFileSet fileSet, String message )
throws ScmException
{
if ( fileSet.getFileList().isEmpty() )
{
throw new ScmException( "You must provide at least one file/directory to remove" );
}
if ( getLogger().isInfoEnabled() )
{
getLogger().info( "SVN remove working directory: " + fileSet.getBasedir().getAbsolutePath() );
}
SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo;
ScmFileEventHandler handler = new ScmFileEventHandler( getLogger(), fileSet.getBasedir() );
javaRepo.getClientManager().getWCClient().setEventHandler( handler );
try
{
SvnJavaUtil.delete( javaRepo.getClientManager(), fileSet, true );
return new RemoveScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() );
}
catch ( SVNException e )
{
return new RemoveScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN remove failed.", e.getMessage(), false );
}
finally
{
javaRepo.getClientManager().getWCClient().setEventHandler( null );
}
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:38,代码来源:SvnJavaRemoveCommand.java
示例17: executeBranchCommand
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public ScmResult executeBranchCommand( ScmProviderRepository repo, ScmFileSet fileSet, String branch,
String message )
throws ScmException
{
ScmBranchParameters scmBranchParameters = new ScmBranchParameters( message );
return executeBranchCommand( repo, fileSet, branch, scmBranchParameters );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:11,代码来源:SvnJavaBranchCommand.java
示例18: doCommit
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
/**
* FIXME remove when upgrading to scm 1.8 as the method commit has been to protected
*/
protected void doCommit( File workingDirectory, ScmRepository repository )
throws Exception
{
CheckInScmResult result = getScmManager().checkIn( repository, new ScmFileSet( workingDirectory ), "No msg" );
assertTrue( "Check result was successful, output: " + result.getCommandOutput(), result.isSuccess() );
List<ScmFile> committedFiles = result.getCheckedInFiles();
assertEquals( "Expected 2 files in the committed files list " + committedFiles, 2, committedFiles.size() );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:15,代码来源:SvnJavaStatusCommandTckTest.java
示例19: testList
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
@Test
public void testList()
throws Exception
{
ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
String url = System.getProperty( "svnUrl" );
String scmUrl = "scm:javasvn:" + url;
SvnJavaScmProviderRepository repository =
new SvnJavaScmProviderRepository( SVNURL.parseURIEncoded( url ), scmUrl );
SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );
ScmFileSet fileSet = new ScmFileSet( new File( "." ), new File( "." ) );
ListScmResult listScmResult = provider.list( repository, fileSet, null );
System.out.println( listScmResult.getFiles() );
boolean containsPom = false;
for ( ScmFile scmFile : listScmResult.getFiles() )
{
if ( StringUtils.equals( scmFile.getPath(), "pom.xml" ) )
{
containsPom = true;
}
}
assertTrue( "pom.xml not in list result", containsPom );
}
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:31,代码来源:SvnJavaListCommandTest.java
示例20: update
import org.apache.maven.scm.ScmFileSet; //导入依赖的package包/类
public List<ScmFile> update()
throws MojoExecutionException
{
try
{
ScmRepository repository = getScmRepository();
ScmProvider scmProvider = scmManager.getProviderByRepository( repository );
UpdateScmResult result = scmProvider.update( repository, new ScmFileSet( scmDirectory ) );
if ( result == null )
{
return Collections.emptyList();
}
checkResult( result );
if ( result instanceof UpdateScmResultWithRevision )
{
String revision = ( (UpdateScmResultWithRevision) result ).getRevision();
getLog().info( "Got a revision during update: " + revision );
this.revision = revision;
}
return result.getUpdatedFiles();
}
catch ( ScmException e )
{
throw new MojoExecutionException( "Couldn't update project. " + e.getMessage(), e );
}
}
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:34,代码来源:CreateMojo.java
注:本文中的org.apache.maven.scm.ScmFileSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论