Index: D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateCommandTest.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateCommandTest.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateCommandTest.java (revision 0) @@ -0,0 +1,59 @@ +package org.apache.maven.scm.provider.vss.commands.update; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; + +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTestCase; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.codehaus.plexus.util.cli.Commandline; + +/** + * @author Emmanuel Venisse + * @version $Id: VssHistoryCommandTest.java 407193 2006-05-17 07:53:27Z evenisse $ + */ +public class VssUpdateCommandTest + extends ScmTestCase +{ + private ScmManager scmManager; + + public void setUp() + throws Exception + { + super.setUp(); + + scmManager = getScmManager(); + } + + public void testCommandLine() + throws Exception + { + ScmRepository repository = + scmManager.makeScmRepository( "scm:vss|username|password@C:/Program File/Visual Source Safe|D:/myProject" ); + ScmFileSet fileSet = new ScmFileSet( getTestFile( "target" ) ); + VssUpdateCommand command = new VssUpdateCommand(); + Commandline cl = command.buildCmdLine( (VssScmProviderRepository) repository.getProviderRepository(), fileSet, + null); + String ssPath = VssCommandLineUtils.getSsDir().replace( '/', File.separatorChar ); + assertEquals( ssPath + "ss Get $D:/myProject -Yusername,password -R -I- -GWS", + cl.toString() ); + } +} Index: D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusCommandTest.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusCommandTest.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusCommandTest.java (revision 0) @@ -0,0 +1,58 @@ +package org.apache.maven.scm.provider.vss.commands.status; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; + +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTestCase; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils; +import org.apache.maven.scm.provider.vss.commands.status.VssStatusCommand; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.codehaus.plexus.util.cli.Commandline; + +/** + * @author Emmanuel Venisse + * @version $Id: VssHistoryCommandTest.java 407193 2006-05-17 07:53:27Z evenisse $ + */ +public class VssStatusCommandTest + extends ScmTestCase +{ + private ScmManager scmManager; + + public void setUp() + throws Exception + { + super.setUp(); + + scmManager = getScmManager(); + } + + public void testCommandLine() + throws Exception + { + ScmRepository repository = scmManager + .makeScmRepository( "scm:vss|username|password@C:/Program File/Visual Source Safe|D:/myProject" ); + ScmFileSet fileSet = new ScmFileSet( getTestFile( "target" ) ); + VssStatusCommand command = new VssStatusCommand(); + Commandline cl = command.buildCmdLine( (VssScmProviderRepository) repository.getProviderRepository(), fileSet ); + String ssPath = VssCommandLineUtils.getSsDir().replace( '/', File.separatorChar ); + assertEquals( ssPath + "ss Diff $D:/myProject -Yusername,password -R -I-", cl.toString() ); + } +} Index: D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutCommandTest.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutCommandTest.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutCommandTest.java (revision 0) @@ -0,0 +1,59 @@ +package org.apache.maven.scm.provider.vss.commands.checkout; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; + +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmTestCase; +import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.apache.maven.scm.repository.ScmRepository; +import org.codehaus.plexus.util.cli.Commandline; + +/** + * @author Emmanuel Venisse + * @version $Id: VssHistoryCommandTest.java 407193 2006-05-17 07:53:27Z evenisse $ + */ +public class VssCheckOutCommandTest + extends ScmTestCase +{ + private ScmManager scmManager; + + public void setUp() + throws Exception + { + super.setUp(); + + scmManager = getScmManager(); + } + + public void testCommandLine() + throws Exception + { + ScmRepository repository = + scmManager.makeScmRepository( "scm:vss|username|password@C:/Program File/Visual Source Safe|D:/myProject" ); + ScmFileSet fileSet = new ScmFileSet( getTestFile( "target" ) ); + VssCheckOutCommand command = new VssCheckOutCommand(); + Commandline cl = command.buildCmdLine( (VssScmProviderRepository) repository.getProviderRepository(), fileSet, + null); + String ssPath = VssCommandLineUtils.getSsDir().replace( '/', File.separatorChar ); + assertEquals( ssPath + "ss Get $D:/myProject -Yusername,password -R -I- -GWR", + cl.toString() ); + } +} Index: D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommandTest.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommandTest.java (revision 410848) +++ D:/work-maven/maven-scm-provider-vss/src/test/java/org/apache/maven/scm/provider/vss/commands/changelog/VssHistoryCommandTest.java (working copy) @@ -62,7 +62,7 @@ String end = sdf.format( endDate ); String ssPath = VssCommandLineUtils.getSsDir().replace( '/', File.separatorChar ); - assertEquals( ssPath + "ss History $D:\\myProject -Yusername,password -R -I- -Vd" + start + "~" + end, + assertEquals( ssPath + "ss History $D:/myProject -Yusername,password -R -I- -Vd" + start + "~" + end, cl.toString() ); } } Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java (revision 410848) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/repository/VssScmProviderRepository.java (working copy) @@ -32,7 +32,8 @@ setUser( user ); setPassword( password ); this.vssdir = StringUtils.replace( vssdir, "/", "\\" ); - this.project = StringUtils.replace( project, "/", "\\" ); +// this.project = StringUtils.replace( project, "/", "\\" ); + this.project = project; } public String getProject() Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateConsumer.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateConsumer.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateConsumer.java (revision 0) @@ -0,0 +1,223 @@ +package org.apache.maven.scm.provider.vss.commands.update; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.log.ScmLogger; +import org.apache.maven.scm.provider.vss.commands.VssConstants; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.apache.maven.scm.util.AbstractConsumer; +import org.codehaus.plexus.util.cli.StreamConsumer; + +/** + * @author Thorsten Riek + * @version $Id: VssGetConsumer.java 374388 2006-02-02 14:00:46Z triek $ + */ +public class VssUpdateConsumer + extends AbstractConsumer + implements StreamConsumer +{ + + /** + * expecting file information + */ + private static final int GET_UNKNOWN = 0; + + /** + * expecting file information + */ + private static final int GET_FILE = 1; + + /** + * expecting file information + */ + private static final int REPLACE_FILE = 2; + + /** + * expecting file path information + */ + private static final int GET_FILE_PATH = 3; + + /** + * expecting writable copy + */ + private static final int IS_WRITABLE_COPY = 4; + + /** + * expecting working folder + */ + private static final int SET_WORKING_FOLDER = 5; + + /** + * Marks start of file data + */ + private static String START_FILE_PATH = "$/"; + + /** + * Marks getting a new File + */ + private static final String START_GETTING = "Getting"; + + /** + * Marks replacing a old File + */ + private static final String START_REPLACING = "Replacing local copy of "; + + /** + * Marks a writable copy of a File / maybe a conflict + */ + private static final String START_WRITABLE_COPY = "A writable "; + + /** + * Marks "Set the default folder for project" question + */ + private static final String CONTAINS_SET_DEFAULT_WORKING_FOLDER = "as the default folder for project"; + + private String currentPath = ""; + + private List updatedFiles = new ArrayList(); + + private VssScmProviderRepository repo; + + public VssUpdateConsumer( VssScmProviderRepository repo, ScmLogger logger ) + { + super( logger ); + this.repo = repo; + } + + public void consumeLine( String line ) + { + getLogger().debug( line ); + + switch ( getLineStatus( line ) ) + { + case GET_FILE_PATH: + processGetFilePath( line ); + break; + case GET_FILE: + processGetFile( line ); + break; + case REPLACE_FILE: + processReplaceFile( line ); + break; + case IS_WRITABLE_COPY: + // FIXME is actually in error stream if command is build without -G- + processWritableFile( line ); + break; + case SET_WORKING_FOLDER: + // to trash + break; + default: + break; + } + } + + /** + * Process the current input line in the Get File state. + * + * @param line a line of text from the VSS log output + */ + private void processGetFile( String line ) + { + String[] fileLine = line.split( " " ); + updatedFiles.add( new ScmFile( currentPath + "/" + fileLine[1], ScmFileStatus.UPDATED ) ); + getLogger().info( fileLine[0] + ": " + currentPath + "/" + fileLine[1] ); + + } + + /** + * Process the current input line in the Replace File state. + * + * @param line a line of text from the VSS log output + */ + private void processReplaceFile( String line ) + { + + updatedFiles.add( new ScmFile( currentPath + "/" + line.substring(START_REPLACING.length()), ScmFileStatus.UPDATED ) ); + getLogger().info( START_REPLACING + currentPath + "/" + line.substring(START_REPLACING.length()) ); + + + } + + /** + * Process the current input line in the Get File Path state. + * + * @param line a line of text from the VSS log output + */ + private void processGetFilePath( String line ) + { + currentPath = line.substring( (VssConstants.PROJECT_PREFIX + repo.getProject()).length() , + line.length() - 1 ); + } + + /** + * Process the current input line in the writable File state. + * + * @param line a line of text from the VSS log output + */ + private void processWritableFile( String line ) + { + // FIXME extract file name + // String[] fileLine = line.split( " " ); + // updatedFiles.add( new ScmFile( currentPath + "/" + fileLine[1], ScmFileStatus.MODIFIED ) ); + // getLogger().info( fileLine[0] + ": " + currentPath + "/" + fileLine[1] ); + + } + + /** + * Identify the status of a vss get line + * + * @param line The line to process + * @return status + */ + private int getLineStatus( String line ) + { + int argument = GET_UNKNOWN; + if ( line.startsWith( START_FILE_PATH ) ) + { + argument = GET_FILE_PATH; + } + else if ( line.startsWith( START_GETTING ) ) + { + argument = GET_FILE; + } + else if ( line.startsWith( START_REPLACING ) ) + { + argument = REPLACE_FILE; + } + else if ( line.startsWith( START_WRITABLE_COPY ) ) + { + argument = IS_WRITABLE_COPY; + } + else if ( line.indexOf( CONTAINS_SET_DEFAULT_WORKING_FOLDER ) != -1 ) + { + argument = SET_WORKING_FOLDER; + } + + return argument; + } + + public List getUpdatedFiles() + { + return updatedFiles; + } + +} Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateCommand.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateCommand.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/update/VssUpdateCommand.java (revision 0) @@ -0,0 +1,136 @@ +package org.apache.maven.scm.provider.vss.commands.update; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.changelog.ChangeLogCommand; +import org.apache.maven.scm.command.update.AbstractUpdateCommand; +import org.apache.maven.scm.command.update.UpdateScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils; +import org.apache.maven.scm.provider.vss.commands.VssConstants; +import org.apache.maven.scm.provider.vss.commands.changelog.VssHistoryCommand; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; + +public class VssUpdateCommand + extends AbstractUpdateCommand +{ +// TODO handle deleted files from VSS + protected UpdateScmResult executeUpdateCommand( ScmProviderRepository repository, ScmFileSet fileSet, String tag ) + throws ScmException + { + getLogger().debug( "executing update command..." ); + + VssScmProviderRepository repo = (VssScmProviderRepository) repository; + + Commandline cl = buildCmdLine( repo, fileSet, tag ); + + VssUpdateConsumer consumer = new VssUpdateConsumer( repo, getLogger() ); + + // TODO handle deleted files from VSS + // TODO identify local files + CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); + + int exitCode; + + getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() ); + + exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); + + if ( exitCode != 0 ) + { + String error = stderr.getOutput(); + getLogger().debug("VSS returns error: ["+error+"] return code: ["+exitCode+"]"); + if (error.indexOf("A writable copy of") < 0) { + return new UpdateScmResult( cl.toString(), "The vss command failed.", error, false ); + } + // print out the writable copy for manual handling + getLogger().warn(error); + } + + return new UpdateScmResult( cl.toString(), consumer.getUpdatedFiles() ); + } + + public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet, String lable ) + throws ScmException + { + + Commandline command = new Commandline(); + + command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); + + try + { + command.addSystemEnvironment(); + } + catch ( Exception e ) + { + throw new ScmException( "Can't add system environment.", e ); + } + + command.addEnvironment( "SSDIR", repo.getVssdir() ); + + String ssDir = VssCommandLineUtils.getSsDir(); + + command.setExecutable( ssDir + VssConstants.SS_EXE ); + + command.createArgument().setValue( VssConstants.COMMAND_GET ); + + command.createArgument().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); + + //User identification to get access to vss repository + if ( repo.getUserPassword() != null ) + { + command.createArgument().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); + } + + //Display the history of an entire project list + command.createArgument().setValue( VssConstants.FLAG_RECURSION ); + + //Ignore: Do not ask for input under any circumstances. + command.createArgument().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); + + // FIXME Update command only works if there is no file checked out + // or no file is dirty locally. It's better than overwriting + // checked out files + //Ignore: Do not touch local writable files. + command.createArgument().setValue( VssConstants.FLAG_SKIP_WRITABLE ); +// command.createArgument().setValue( VssConstants.FLAG_REPLACE_WRITABLE ); + + + // ToDo: Get Labled Version + // command.createArgument().setValue( VssConstants.FLAG_VERSION_LABEL ); + + return command; + } + + /** + * @see org.apache.maven.scm.command.update.AbstractUpdateCommand#getChangeLogCommand() + */ + protected ChangeLogCommand getChangeLogCommand() + { + VssHistoryCommand command = new VssHistoryCommand(); + + command.setLogger( getLogger() ); + + return command; + } + +} Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java (revision 410848) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssCommandLineUtils.java (working copy) @@ -33,6 +33,7 @@ import java.io.FileReader; import java.io.IOException; +// FIXME extend CommandLineUtils public class VssCommandLineUtils implements VssConstants { @@ -44,7 +45,7 @@ } } - public static Commandline getBaseSvnCommandLine( File workingDirectory, String cmd, + public static Commandline getBaseVssCommandLine( File workingDirectory, String cmd, VssScmProviderRepository repository ) { Commandline cl = new Commandline(); @@ -77,7 +78,11 @@ logger.info( "Executing: " + cl ); logger.info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); - return CommandLineUtils.executeCommandLine( cl, consumer, stderr ); + int exitcode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); + + logger.debug( "VSS Command Exit_Code: " + exitcode ); + + return exitcode; } catch ( CommandLineException ex ) { Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java (revision 0) @@ -0,0 +1,304 @@ +package org.apache.maven.scm.provider.vss.commands.status; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.log.ScmLogger; +import org.apache.maven.scm.provider.vss.commands.VssConstants; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.apache.maven.scm.util.AbstractConsumer; +import org.codehaus.plexus.util.cli.StreamConsumer; + +/** + * @author Thorsten Riek + * @version $Id: VssGetConsumer.java 374388 2006-02-02 14:00:46Z triek $ + */ +public class VssStatusConsumer + extends AbstractConsumer + implements StreamConsumer +{ + + /** + * expecting file information + */ + private static final int DIFF_UNKNOWN = 0; + + /** + * expecting files to checkin + */ + private static final int DIFF_LOCAL_FILES_NOT_IN_PROJECT = 1; + + /** + * expecting commit + */ + private static final int DIFF_VSS_FILES_DIFFERENT_FROM_LOCAL_FILES = 2; + + /** + * expecting update / checkout + */ + private static final int DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER = 3; + + /** + * expecting setting akt remote folder + */ + private static final int DIFF_START_DIFFING_REMOTE = 4; + + /** + * expecting setting akt local folder + */ + private static final int DIFF_START_DIFFING_LOCAL = 5; + + /** + * Marks start of file data + */ + private static String START_FILE_PATH = "$/"; + + /** + * Marks Diffing remote project folder + */ + private static final String START_DIFFING_REMOTE = "Diffing:"; + + /** + * Marks Diffing local project folder + */ + private static final String START_DIFFING_LOCAL = "Against:"; + + // Diffing: $/com.fum/fum-utilities + // Against: D:\work\fum-utilities + + /** + * Marks Local files not in the current project + */ + private static final String LOCAL_FILES_NOT_IN_PROJECT = "Local files not in the current project:"; + + // .classpath .project Diff.txt getVSS.xml out.txt + + /** + * Marks SourceSafe files different from local files + */ + private static final String VSS_FILES_DIFFERENT_FROM_LOCAL_FILES = "SourceSafe files different from local files:"; + + // .classpath .project Diff.txt getVSS.xml out.txt + + /** + * Marks SourceSafe files not in the current folder + */ + private static final String VSS_FILES_NOT_IN_CURRENT_FOLDER = "SourceSafe files not in the current folder:"; + + /** + * Marks "Set the default folder for project" question + */ + private static final String CONTAINS_SET_DEFAULT_WORKING_FOLDER = "as the default folder for project"; + + private String remoteProjectFolder = ""; + + private String localFolder = ""; + + private int lastState = 0; + + private List updatedFiles = new ArrayList(); + + private VssScmProviderRepository repo; + + private ScmFileSet fileSet; + + public VssStatusConsumer( VssScmProviderRepository repo, ScmLogger logger, ScmFileSet fileSet ) + { + super( logger ); + this.repo = repo; + this.fileSet = fileSet; + } + + public void consumeLine( String line ) + { + + switch ( getLineStatus( line ) ) + { + case DIFF_LOCAL_FILES_NOT_IN_PROJECT: + getLogger().debug( line ); + lastState = DIFF_LOCAL_FILES_NOT_IN_PROJECT; + break; + case DIFF_VSS_FILES_DIFFERENT_FROM_LOCAL_FILES: + getLogger().debug( line ); + lastState = DIFF_VSS_FILES_DIFFERENT_FROM_LOCAL_FILES; + break; + case DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER: + getLogger().debug( line ); + lastState = DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER; + break; + case DIFF_START_DIFFING_LOCAL: + getLogger().debug( line ); + processLocalFolder( line ); + break; + case DIFF_START_DIFFING_REMOTE: + getLogger().debug( line ); + processRemoteProjectFolder( line ); + break; + default: + getLogger().debug( line ); + processLastStateFiles( line ); + break; + } + } + + /** + * Process the current input line in the Get File state. + * + * @param line a line of text from the VSS log output + */ + private void processLastStateFiles( String line ) + { + + if ( line != null && line.trim().length() > 0 ) + { + String[] fileLine = line.split( " " ); + for ( int i = 0; i < fileLine.length; i++ ) + { + if ( fileLine[i].trim().length() > 0 ) + { + if ( lastState == DIFF_LOCAL_FILES_NOT_IN_PROJECT ) + { + updatedFiles.add( new ScmFile( localFolder + fileLine[i], ScmFileStatus.ADDED ) ); + } + else if ( lastState == DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER ) + { + updatedFiles.add( new ScmFile( localFolder + fileLine[i], ScmFileStatus.UPDATED ) ); + } + else if ( lastState == DIFF_VSS_FILES_DIFFERENT_FROM_LOCAL_FILES ) + { + updatedFiles.add( new ScmFile( localFolder + fileLine[i], ScmFileStatus.MODIFIED ) ); + } + getLogger().debug( localFolder + fileLine[i] ); + } + } + } + else + { + getLogger().debug( "processLastStateFiles: empty line" ); + } + + } + + /** + * Process the current input line in the Get File Path state. + * + * @param line a line of text from the VSS log output + */ + private void processLocalFolder( String line ) + { + + int folderLength = ( START_DIFFING_LOCAL + " " + fileSet.getBasedir().getAbsolutePath() ).length(); + + if ( folderLength < line.length() ) + { + setLocalFolder( line.substring( folderLength, line.length() ) ); + } + else + { + setLocalFolder( "" ); + } + + } + + /** + * Process the current input line in the Get File Path state. + * + * @param line a line of text from the VSS log output + */ + private void processRemoteProjectFolder( String line ) + { + + int folderLength = ( START_DIFFING_REMOTE + " " + VssConstants.PROJECT_PREFIX + repo.getProject() ).length(); + + if ( folderLength < line.length() ) + { + setRemoteProjectFolder( line.substring( folderLength, line.length() ) ); + } + else + { + setRemoteProjectFolder( "" ); + } + + } + + /** + * Identify the status of a vss get line + * + * @param line The line to process + * @return status + */ + private int getLineStatus( String line ) + { + int argument = DIFF_UNKNOWN; + if ( line.startsWith( LOCAL_FILES_NOT_IN_PROJECT ) ) + { + argument = DIFF_LOCAL_FILES_NOT_IN_PROJECT; + } + else if ( line.startsWith( VSS_FILES_DIFFERENT_FROM_LOCAL_FILES ) ) + { + argument = DIFF_VSS_FILES_DIFFERENT_FROM_LOCAL_FILES; + } + else if ( line.startsWith( VSS_FILES_NOT_IN_CURRENT_FOLDER ) ) + { + argument = DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER; + } + // else if ( line.startsWith( VSS_FILES_NOT_IN_CURRENT_FOLDER ) ) + // { + // Project $/com.fum/fum-utilities/src/main/java/com/fum/utilities/protocol has no + // corresponding folder + // argument = DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER; + // } + else if ( line.startsWith( START_DIFFING_LOCAL ) ) + { + argument = DIFF_START_DIFFING_LOCAL; + } + else if ( line.startsWith( START_DIFFING_REMOTE ) ) + { + argument = DIFF_START_DIFFING_REMOTE; + } + + return argument; + } + + public List getUpdatedFiles() + { + return updatedFiles; + } + + private void setLocalFolder( String localFolder ) + { + if ( localFolder != null && localFolder.trim().length() > 0 ) + { + this.localFolder = localFolder.replace( java.io.File.separatorChar, '/' ) + "/"; + } + else + { + this.localFolder = ""; + } + } + + private void setRemoteProjectFolder( String remoteProjectFolder ) + { + this.remoteProjectFolder = remoteProjectFolder; + } + +} Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusCommand.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusCommand.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusCommand.java (revision 0) @@ -0,0 +1,126 @@ +package org.apache.maven.scm.provider.vss.commands.status; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.changelog.ChangeLogCommand; +import org.apache.maven.scm.command.status.AbstractStatusCommand; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils; +import org.apache.maven.scm.provider.vss.commands.VssConstants; +import org.apache.maven.scm.provider.vss.commands.changelog.VssHistoryCommand; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; + +public class VssStatusCommand + extends AbstractStatusCommand +{ + protected StatusScmResult executeStatusCommand( ScmProviderRepository repository, ScmFileSet fileSet ) + throws ScmException + { + getLogger().debug( "executing status command..." ); + + VssScmProviderRepository repo = (VssScmProviderRepository) repository; + + Commandline cl = buildCmdLine( repo, fileSet ); + + VssStatusConsumer consumer = new VssStatusConsumer( repo, getLogger(), fileSet ); + + CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); + + int exitCode; + + getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() ); + + exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); + + if ( exitCode != 0 ) + { + String error = stderr.getOutput(); + getLogger().debug( "VSS returns error: [" + error + "] return code: [" + exitCode + "]" ); + if ( false ) + { + return new StatusScmResult( cl.toString(), "The vss command failed.", error, false ); + } + // print out the writable copy for manual handling + // getLogger().warn(error); + } + + return new StatusScmResult( cl.toString(), consumer.getUpdatedFiles() ); + } + + public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet ) + throws ScmException + { + + Commandline command = new Commandline(); + + command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); + + try + { + command.addSystemEnvironment(); + } + catch ( Exception e ) + { + throw new ScmException( "Can't add system environment.", e ); + } + + command.addEnvironment( "SSDIR", repo.getVssdir() ); + + String ssDir = VssCommandLineUtils.getSsDir(); + + command.setExecutable( ssDir + VssConstants.SS_EXE ); + + command.createArgument().setValue( VssConstants.COMMAND_DIFF ); + + command.createArgument().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); + + //User identification to get access to vss repository + if ( repo.getUserPassword() != null ) + { + command.createArgument().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); + } + + //Display the history of an entire project list + command.createArgument().setValue( VssConstants.FLAG_RECURSION ); + + //Ignore: Do not ask for input under any circumstances. + command.createArgument().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); + + // TODO: Get Labled Version + // command.createArgument().setValue( VssConstants.FLAG_VERSION_LABEL ); + + return command; + } + + /** + * @see org.apache.maven.scm.command.update.AbstractUpdateCommand#getChangeLogCommand() + */ + protected ChangeLogCommand getChangeLogCommand() + { + VssHistoryCommand command = new VssHistoryCommand(); + + command.setLogger( getLogger() ); + + return command; + } + +} Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutCommand.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutCommand.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutCommand.java (revision 0) @@ -0,0 +1,131 @@ +package org.apache.maven.scm.provider.vss.commands.checkout; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.changelog.ChangeLogCommand; +import org.apache.maven.scm.command.checkout.AbstractCheckOutCommand; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.provider.ScmProviderRepository; +import org.apache.maven.scm.provider.vss.commands.VssCommandLineUtils; +import org.apache.maven.scm.provider.vss.commands.VssConstants; +import org.apache.maven.scm.provider.vss.commands.changelog.VssHistoryCommand; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.codehaus.plexus.util.cli.CommandLineUtils; +import org.codehaus.plexus.util.cli.Commandline; + +public class VssCheckOutCommand + extends AbstractCheckOutCommand +{ + + protected CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repository, ScmFileSet fileSet, String tag ) + throws ScmException + { + getLogger().debug( "executing checkout command..." ); + + VssScmProviderRepository repo = (VssScmProviderRepository) repository; + + Commandline cl = buildCmdLine( repo, fileSet, tag ); + + VssCheckOutConsumer consumer = new VssCheckOutConsumer( repo, getLogger() ); + + // TODO handle deleted files from VSS + CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); + + int exitCode; + + getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() ); + + exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); + + if ( exitCode != 0 ) + { + String error = stderr.getOutput(); + getLogger().debug( "VSS returns error: [" + error + "] return code: [" + exitCode + "]" ); + if ( error.indexOf( "A writable copy of" ) < 0 ) + { + return new CheckOutScmResult( cl.toString(), "The vss command failed.", error, false ); + } + // print out the writable copy for manual handling + getLogger().warn( error ); + } + + return new CheckOutScmResult( cl.toString(), consumer.getUpdatedFiles() ); + } + + public Commandline buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet, String lable ) + throws ScmException + { + + Commandline command = new Commandline(); + + command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); + + try + { + command.addSystemEnvironment(); + } + catch ( Exception e ) + { + throw new ScmException( "Can't add system environment.", e ); + } + + command.addEnvironment( "SSDIR", repo.getVssdir() ); + + String ssDir = VssCommandLineUtils.getSsDir(); + + command.setExecutable( ssDir + VssConstants.SS_EXE ); + + command.createArgument().setValue( VssConstants.COMMAND_GET ); + + command.createArgument().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() ); + + //User identification to get access to vss repository + if ( repo.getUserPassword() != null ) + { + command.createArgument().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() ); + } + + //Display the history of an entire project list + command.createArgument().setValue( VssConstants.FLAG_RECURSION ); + + //Ignore: Do not ask for input under any circumstances. + command.createArgument().setValue( VssConstants.FLAG_AUTORESPONSE_DEF ); + + //Ignore: Do not touch local writable files. + command.createArgument().setValue( VssConstants.FLAG_REPLACE_WRITABLE ); + + // TODO: Get Labled Version + // command.createArgument().setValue( VssConstants.FLAG_VERSION_LABEL ); + + return command; + } + + /** + * @see org.apache.maven.scm.command.checkout.AbstractCheckOutCommand#getChangeLogCommand() + */ + protected ChangeLogCommand getChangeLogCommand() + { + VssHistoryCommand command = new VssHistoryCommand(); + + command.setLogger( getLogger() ); + + return command; + } + +} Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutConsumer.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutConsumer.java (revision 0) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkout/VssCheckOutConsumer.java (revision 0) @@ -0,0 +1,204 @@ +package org.apache.maven.scm.provider.vss.commands.checkout; + +/* + * Copyright 2001-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.scm.ScmFile; +import org.apache.maven.scm.ScmFileStatus; +import org.apache.maven.scm.log.ScmLogger; +import org.apache.maven.scm.provider.vss.commands.VssConstants; +import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; +import org.apache.maven.scm.util.AbstractConsumer; +import org.codehaus.plexus.util.cli.StreamConsumer; + +/** + * @author Thorsten Riek + * @version $Id: VssGetConsumer.java 374388 2006-02-02 14:00:46Z triek $ + */ +public class VssCheckOutConsumer + extends AbstractConsumer + implements StreamConsumer +{ + + /** + * expecting file information + */ + private static final int GET_UNKNOWN = 0; + + /** + * expecting file information + */ + private static final int GET_FILE = 1; + + /** + * expecting file information + */ + private static final int REPLACE_FILE = 2; + + /** + * expecting file path information + */ + private static final int GET_FILE_PATH = 3; + + /** + * expecting writable copy + */ + private static final int IS_WRITABLE_COPY = 4; + + /** + * expecting working folder + */ + private static final int SET_WORKING_FOLDER = 5; + + /** + * Marks start of file data + */ + private static String START_FILE_PATH = "$/"; + + /** + * Marks getting a new File + */ + private static final String START_GETTING = "Getting"; + + /** + * Marks replacing a old File + */ + private static final String START_REPLACING = "Replacing local copy of "; + + /** + * Marks a writable copy of a File / maybe a conflict + */ + private static final String START_WRITABLE_COPY = "A writable "; + + /** + * Marks "Set the default folder for project" question + */ + private static final String CONTAINS_SET_DEFAULT_WORKING_FOLDER = "as the default folder for project"; + + private String currentPath = ""; + + private List updatedFiles = new ArrayList(); + + private VssScmProviderRepository repo; + + public VssCheckOutConsumer( VssScmProviderRepository repo, ScmLogger logger ) + { + super( logger ); + this.repo = repo; + } + + public void consumeLine( String line ) + { + getLogger().debug( line ); + + switch ( getLineStatus( line ) ) + { + case GET_FILE_PATH: + processGetFilePath( line ); + break; + case GET_FILE: + processGetFile( line ); + break; + case REPLACE_FILE: + processReplaceFile( line ); + break; + case IS_WRITABLE_COPY: + // will be overwritten and uses REPLACE_FILE + break; + case SET_WORKING_FOLDER: + // to trash + break; + default: + break; + } + } + + /** + * Process the current input line in the Get File state. + * + * @param line a line of text from the VSS log output + */ + private void processGetFile( String line ) + { + String[] fileLine = line.split( " " ); + updatedFiles.add( new ScmFile( currentPath + "/" + fileLine[1], ScmFileStatus.UPDATED ) ); + getLogger().info( fileLine[0] + ": " + currentPath + "/" + fileLine[1] ); + } + + /** + * Process the current input line in the Replace File state. + * + * @param line a line of text from the VSS log output + */ + private void processReplaceFile( String line ) + { + updatedFiles.add( new ScmFile( currentPath + "/" + line.substring(START_REPLACING.length()), ScmFileStatus.UPDATED ) ); + getLogger().info( START_REPLACING + currentPath + "/" + line.substring(START_REPLACING.length()) ); + } + + /** + * Process the current input line in the Get File Path state. + * + * @param line a line of text from the VSS log output + */ + private void processGetFilePath( String line ) + { + currentPath = line.substring( (VssConstants.PROJECT_PREFIX + repo.getProject()).length() , + line.length() - 1 ); + } + + /** + * Identify the status of a vss get line + * + * @param line The line to process + * @return status + */ + private int getLineStatus( String line ) + { + int argument = GET_UNKNOWN; + if ( line.startsWith( START_FILE_PATH ) ) + { + argument = GET_FILE_PATH; + } + else if ( line.startsWith( START_GETTING ) ) + { + argument = GET_FILE; + } + else if ( line.startsWith( START_REPLACING ) ) + { + argument = REPLACE_FILE; + } + else if ( line.startsWith( START_WRITABLE_COPY ) ) + { + argument = IS_WRITABLE_COPY; + } + else if ( line.indexOf( CONTAINS_SET_DEFAULT_WORKING_FOLDER ) != -1 ) + { + argument = SET_WORKING_FOLDER; + } + + return argument; + } + + public List getUpdatedFiles() + { + return updatedFiles; + } + +} Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java (revision 410848) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/VssConstants.java (working copy) @@ -72,6 +72,16 @@ String COMMAND_CREATE = "Create"; /** + * The 'Status' command + */ + String COMMAND_DIFF = "Diff"; + + /** + * The 'Status' command + */ + String COMMAND_STATUS = "Status"; + + /** * The brief style flag */ String STYLE_BRIEF = "brief"; Index: D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java =================================================================== --- D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java (revision 410848) +++ D:/work-maven/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/VssScmProvider.java (working copy) @@ -20,9 +20,15 @@ import org.apache.maven.scm.ScmException; import org.apache.maven.scm.ScmFileSet; import org.apache.maven.scm.command.changelog.ChangeLogScmResult; +import org.apache.maven.scm.command.checkout.CheckOutScmResult; +import org.apache.maven.scm.command.status.StatusScmResult; +import org.apache.maven.scm.command.update.UpdateScmResult; import org.apache.maven.scm.provider.AbstractScmProvider; import org.apache.maven.scm.provider.ScmProviderRepository; import org.apache.maven.scm.provider.vss.commands.changelog.VssHistoryCommand; +import org.apache.maven.scm.provider.vss.commands.checkout.VssCheckOutCommand; +import org.apache.maven.scm.provider.vss.commands.status.VssStatusCommand; +import org.apache.maven.scm.provider.vss.commands.update.VssUpdateCommand; import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; import org.apache.maven.scm.repository.ScmRepository; import org.apache.maven.scm.repository.ScmRepositoryException; @@ -106,43 +112,42 @@ * org.apache.maven.scm.ScmFileSet, * org.apache.maven.scm.CommandParameters) */ -/* - public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) - throws ScmException - { - // TODO: Check whether the CREATE command must be called - VssAddCommand command = new VssAddCommand(); - command.setLogger( getLogger() ); + /* + public AddScmResult add( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + // TODO: Check whether the CREATE command must be called + VssAddCommand command = new VssAddCommand(); + command.setLogger( getLogger() ); - return (AddScmResult) command.execute( repository - .getProviderRepository(), fileSet, parameters ); - } -*/ + return (AddScmResult) command.execute( repository + .getProviderRepository(), fileSet, parameters ); + } + */ /** * @see org.apache.maven.scm.provider.AbstractScmProvider#checkin(org.apache.maven.scm.repository.ScmRepository, * org.apache.maven.scm.ScmFileSet, * org.apache.maven.scm.CommandParameters) */ -/* - public CheckInScmResult checkin( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) - throws ScmException - { - VssCheckInCommand command = new VssCheckInCommand(); + /* + public CheckInScmResult checkin( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + VssCheckInCommand command = new VssCheckInCommand(); - command.setLogger( getLogger() ); + command.setLogger( getLogger() ); - return (CheckInScmResult) command.execute( repository - .getProviderRepository(), fileSet, parameters ); - } -*/ + return (CheckInScmResult) command.execute( repository + .getProviderRepository(), fileSet, parameters ); + } + */ /** * @see org.apache.maven.scm.provider.AbstractScmProvider#checkout(org.apache.maven.scm.repository.ScmRepository, * org.apache.maven.scm.ScmFileSet, * org.apache.maven.scm.CommandParameters) */ -/* public CheckOutScmResult checkout( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { @@ -150,10 +155,8 @@ command.setLogger( getLogger() ); - return (CheckOutScmResult) command.execute( repository - .getProviderRepository(), fileSet, parameters ); + return (CheckOutScmResult) command.execute( repository.getProviderRepository(), fileSet, parameters ); } -*/ /** * @see org.apache.maven.scm.provider.AbstractScmProvider#changelog(org.apache.maven.scm.repository.ScmRepository, @@ -167,8 +170,7 @@ command.setLogger( getLogger() ); - return (ChangeLogScmResult) command.execute( repository - .getProviderRepository(), fileSet, parameters ); + return (ChangeLogScmResult) command.execute( repository.getProviderRepository(), fileSet, parameters ); } /** @@ -176,52 +178,99 @@ * org.apache.maven.scm.ScmFileSet, * org.apache.maven.scm.CommandParameters) */ -/* - public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + /* + public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + VssLabelCommand command = new VssLabelCommand(); + + command.setLogger( getLogger() ); + + return (TagScmResult) command.execute( repository + .getProviderRepository(), fileSet, parameters ); + } + */ + + /** + * @see org.apache.maven.scm.provider.AbstractScmProvider#update(org.apache.maven.scm.repository.ScmRepository, + * org.apache.maven.scm.ScmFileSet, + * org.apache.maven.scm.CommandParameters) + */ + public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { - VssLabelCommand command = new VssLabelCommand(); + VssUpdateCommand command = new VssUpdateCommand(); command.setLogger( getLogger() ); - return (TagScmResult) command.execute( repository - .getProviderRepository(), fileSet, parameters ); + return (UpdateScmResult) command.execute( repository.getProviderRepository(), fileSet, parameters ); } -*/ /** - * @see org.apache.maven.scm.provider.AbstractScmProvider#update(org.apache.maven.scm.repository.ScmRepository, - * org.apache.maven.scm.ScmFileSet, + * @see org.apache.maven.scm.provider.AbstractScmProvider#status(org.apache.maven.scm.repository.ScmRepository, + * org.apache.maven.scm.ScmFileSet, * org.apache.maven.scm.CommandParameters) */ -/* - public UpdateScmResult update( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + public StatusScmResult status( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { - VssGetCommand command = new VssGetCommand(); + VssStatusCommand command = new VssStatusCommand(); command.setLogger( getLogger() ); - return (UpdateScmResult) command.execute( repository - .getProviderRepository(), fileSet, parameters ); + return (StatusScmResult) command.execute( repository.getProviderRepository(), fileSet, parameters ); } -*/ /** - * @see org.apache.maven.scm.provider.AbstractScmProvider#remove(org.apache.maven.scm.repository.ScmRepository, - * org.apache.maven.scm.ScmFileSet, + * @see org.apache.maven.scm.provider.AbstractScmProvider#edit(org.apache.maven.scm.repository.ScmRepository, + * org.apache.maven.scm.ScmFileSet, * org.apache.maven.scm.CommandParameters) */ -/* - protected RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + /* + public EditScmResult edit( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { - VssRemoveCommand command = new VssRemoveCommand(); + VssEditCommand command = new VssEditCommand(); command.setLogger( getLogger() ); - return (RemoveScmResult) command.execute( repository - .getProviderRepository(), fileSet, parameters ); + return (EditScmResult) command.execute( repository.getProviderRepository(), fileSet, parameters ); } -*/ + */ + + /** + * @see org.apache.maven.scm.provider.AbstractScmProvider#unedit(org.apache.maven.scm.repository.ScmRepository, + * org.apache.maven.scm.ScmFileSet, + * org.apache.maven.scm.CommandParameters) + */ + /* + public UnEditScmResult unedit( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + VssUnEditCommand command = new VssUnEditCommand(); + + command.setLogger( getLogger() ); + + return (UnEditScmResult) command.execute( repository.getProviderRepository(), fileSet, parameters ); + } + */ + + /** + * @see org.apache.maven.scm.provider.AbstractScmProvider#remove(org.apache.maven.scm.repository.ScmRepository, + * org.apache.maven.scm.ScmFileSet, + * org.apache.maven.scm.CommandParameters) + */ + /* + protected RemoveScmResult remove( ScmRepository repository, ScmFileSet fileSet, CommandParameters parameters ) + throws ScmException + { + VssRemoveCommand command = new VssRemoveCommand(); + + command.setLogger( getLogger() ); + + return (RemoveScmResult) command.execute( repository + .getProviderRepository(), fileSet, parameters ); + } + */ + }