/** * Copyright (c) 2010 Perforce Software. All rights reserved. */ package com.perforce.maven.scm.provider.p4.command.update; import org.apache.maven.scm.CommandParameter; import org.apache.maven.scm.CommandParameters; import org.apache.maven.scm.ScmException; import org.apache.maven.scm.ScmFileSet; import org.apache.maven.scm.ScmVersion; import org.apache.maven.scm.command.changelog.ChangeLogCommand; import org.apache.maven.scm.command.checkout.CheckOutScmResult; import org.apache.maven.scm.command.update.AbstractUpdateCommand; import org.apache.maven.scm.command.update.UpdateScmResult; import org.apache.maven.scm.command.update.UpdateScmResultWithRevision; import org.apache.maven.scm.provider.ScmProviderRepository; import com.perforce.maven.scm.provider.p4.command.P4Command; import com.perforce.maven.scm.provider.p4.command.changelog.P4ChangeLogCommand; import com.perforce.maven.scm.provider.p4.command.checkout.P4CheckOutCommand; import com.perforce.p4java.client.IClient; /** * Use Perforce sync command to update files from the repository. */ public class P4UpdateCommand extends AbstractUpdateCommand implements P4Command { /** The Constant command. */ public static final String command = "Perforce sync command"; private IClient client; public void setClient( IClient client ) { this.client = client; } /** * @see org.apache.maven.scm.command.update.AbstractUpdateCommand * executeUpdateCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, * org.apache.maven.scm.ScmVersion) */ protected UpdateScmResult executeUpdateCommand( ScmProviderRepository repo, ScmFileSet files, ScmVersion scmVersion ) throws ScmException { // Update is the same as checkout in Perforce P4CheckOutCommand command = new P4CheckOutCommand(); command.setLogger( getLogger() ); command.setClient( client ); CommandParameters params = new CommandParameters(); params.setScmVersion( CommandParameter.SCM_VERSION, scmVersion ); CheckOutScmResult checkOutScmResult = (CheckOutScmResult) command.execute( repo, files, params ); if ( !checkOutScmResult.isSuccess() ) { return new UpdateScmResult( checkOutScmResult.getCommandLine(), checkOutScmResult.getProviderMessage(), checkOutScmResult.getCommandOutput(), false ); } return new UpdateScmResultWithRevision( checkOutScmResult.getCheckedOutFiles(), null, null, checkOutScmResult ); //AbstractUpdateCommand will handle changeset after this } /** * @see org.apache.maven.scm.command.update.AbstractUpdateCommand#getChangeLogCommand () */ protected ChangeLogCommand getChangeLogCommand() { P4ChangeLogCommand command = new P4ChangeLogCommand(); command.setLogger( getLogger() ); command.setClient( client ); return command; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 9519 | dantran | folder rename to match with its artifactId | ||
#5 | 9499 | dantran |
Discover latest revision expected by scm:update goal Check for error under IFileSpec during client discovery |
||
#4 | 9486 | dantran | Simplify update command and rely on AbstractUpdateCommand to gather the ChangeSet | ||
#3 | 9422 | dantran | add update, changelog TCK | ||
#2 | 9250 | dantran | caching client across mutiple commands | ||
#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/update/P4UpdateCommand.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/update/P4UpdateCommand.java | |||||
#1 | 8270 | Matt Attaway | Initial add of P4Maven source code |