/** * Copyright (c) 2010 Perforce Software. All rights reserved. */ package com.perforce.maven.scm.provider.p4.command.remove; import java.util.List; import org.apache.maven.scm.ScmException; import org.apache.maven.scm.ScmFile; import org.apache.maven.scm.ScmFileSet; import org.apache.maven.scm.ScmResult; import org.apache.maven.scm.command.remove.AbstractRemoveCommand; import org.apache.maven.scm.command.remove.RemoveScmResult; import org.apache.maven.scm.provider.ScmProviderRepository; import com.perforce.maven.scm.provider.p4.command.P4Command; import com.perforce.maven.scm.provider.p4.util.P4Utils; import com.perforce.p4java.client.IClient; import com.perforce.p4java.core.file.IFileSpec; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.option.client.DeleteFilesOptions; /** * The class uses the Perforce delete command to open existing files for deletion from the depot. */ public class P4RemoveCommand extends AbstractRemoveCommand implements P4Command { /** The Constant command. */ public static final String command = "Perforce delete command"; private IClient client; public void setClient( IClient client ) { this.client = client; } /** * @see org.apache.maven.scm.command.remove.AbstractRemoveCommand * executeRemoveCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, * java.lang.String) */ protected ScmResult executeRemoveCommand( ScmProviderRepository repo, ScmFileSet files, String message ) throws ScmException { P4RemoveResult p4Result = new P4RemoveResult(); List<IFileSpec> fileSpecs = P4Utils.scmFileSet2P4FileSpecsWithNoP4WildCard( files ); try { if ( !fileSpecs.isEmpty() ) { DeleteFilesOptions options = new DeleteFilesOptions(); List<IFileSpec> retFileSpecs = client.deleteFiles( fileSpecs, options ); p4Result.process( retFileSpecs ); p4Result.processRemovals( retFileSpecs ); } } catch ( P4JavaException e ) { throw new ScmException( e.getLocalizedMessage(), e ); } List<ScmFile> removals = p4Result.getRemovals(); return new RemoveScmResult( command, removals ); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#8 | 9519 | dantran | folder rename to match with its artifactId | ||
#7 | 9498 | dantran |
- Setup Maven site for documetation - Implement ~/m2/p4maven-settings.xml to store external config overridable by system properties. All global settings now can be retrieved va P4Utils |
||
#6 | 9422 | dantran | add update, changelog TCK | ||
#5 | 9342 | dantran | Add CheckIn TCK | ||
#4 | 9251 | dantran | Use P4Utils instead of P4Executor which will be retire | ||
#3 | 9250 | dantran | caching client across mutiple commands | ||
#2 | 9177 | dantran |
Compatible with maven-scm-api-1.5+. The current 1.4 is too old |
||
#1 | 9167 | dantran |
Populate //guest/dantran/p4maven/... from //guest/perforce_software/p4maven/main/.... |
||
//guest/perforce_software/p4maven/main/com.perforce.maven/src/main/java/com/perforce/maven/scm/provider/p4/command/remove/P4RemoveCommand.java | |||||
#1 | 8496 | Matt Attaway | Move P4Ant and P4Maven into their proper homes | ||
//public/perforce/p4maven/main/com.perforce.maven/src/main/java/com/perforce/maven/scm/provider/p4/command/remove/P4RemoveCommand.java | |||||
#1 | 8270 | Matt Attaway | Initial add of P4Maven source code |