[maven-scm] copy for tag maven-scm-1.3

git-svn-id: https://svn.apache.org/repos/asf/maven/scm/tags/maven-scm-1.3@897854 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java b/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java
index 50ef4c9..ac10a4b 100644
--- a/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java
+++ b/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java
@@ -42,22 +42,22 @@
  * @since 1.3
  * 
  */
-public class VssCheckInCommand extends AbstractCheckInCommand {
+public class VssCheckInCommand
+    extends AbstractCheckInCommand
+{
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @seeorg.apache.maven.scm.command.checkin.AbstractCheckInCommand#
-	 * executeCheckInCommand
-	 * (org.apache.maven.scm.provider.ScmProviderRepository,
-	 * org.apache.maven.scm.ScmFileSet, java.lang.String,
-	 * org.apache.maven.scm.ScmVersion)
-	 */
-	protected CheckInScmResult executeCheckInCommand(
-			ScmProviderRepository repository, ScmFileSet fileSet,
-			String message, ScmVersion scmVersion) throws ScmException
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.apache.maven.scm.command.checkin.AbstractCheckInCommand# executeCheckInCommand
+     * (org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet,
+     * java.lang.String, org.apache.maven.scm.ScmVersion)
+     */
+    protected CheckInScmResult executeCheckInCommand( ScmProviderRepository repository, ScmFileSet fileSet,
+                                                      String message, ScmVersion scmVersion )
+        throws ScmException
     {
-		if ( getLogger().isDebugEnabled() )
+        if ( getLogger().isDebugEnabled() )
         {
             getLogger().debug( "executing checkin command..." );
         }
@@ -72,124 +72,141 @@
         CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
 
         int exitCode;
-        
+
         StringBuffer sb = new StringBuffer();
         List updatedFiles = new ArrayList();
-        
-        for (Iterator i = commandLines.iterator(); i.hasNext();) {
 
-        	Commandline cl = (Commandline) i.next();
-	
-	        if ( getLogger().isDebugEnabled() )
-	        {
-	            getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() );
-	        }
-	
-	        exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
-	
-	        if ( exitCode != 0 )
-	        {
-	            String error = stderr.getOutput();
-	
-	            if ( getLogger().isDebugEnabled() )
-	            {
-	                getLogger().debug( "VSS returns error: [" + error + "] return code: [" + exitCode + "]" );
-	            }
-	            if ( error.indexOf( "A writable copy of" ) < 0 )
-	            {
-	                return new CheckInScmResult( cl.toString(), "The vss command failed.", error, false );
-	            }
-	            // print out the writable copy for manual handling
-	            if ( getLogger().isWarnEnabled() )
-	            {
-	                getLogger().warn( error );
-	            }
-	        }
+        for ( Iterator i = commandLines.iterator(); i.hasNext(); )
+        {
+
+            Commandline cl = (Commandline) i.next();
+
+            if ( getLogger().isDebugEnabled() )
+            {
+                getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() );
+            }
+
+            exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
+
+            if ( exitCode != 0 )
+            {
+                String error = stderr.getOutput();
+
+                if ( getLogger().isDebugEnabled() )
+                {
+                    getLogger().debug( "VSS returns error: [" + error + "] return code: [" + exitCode + "]" );
+                }
+                if ( error.indexOf( "A writable copy of" ) < 0 )
+                {
+                    return new CheckInScmResult( cl.toString(), "The vss command failed.", error, false );
+                }
+                // print out the writable copy for manual handling
+                if ( getLogger().isWarnEnabled() )
+                {
+                    getLogger().warn( error );
+                }
+            }
 
         }
         return new CheckInScmResult( sb.toString(), updatedFiles );
     }
 
-	public List buildCmdLine(VssScmProviderRepository repo,
-			ScmFileSet fileSet, ScmVersion version) throws ScmException {
+    public List buildCmdLine( VssScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version )
+        throws ScmException
+    {
 
         List files = fileSet.getFileList();
         List commands = new ArrayList();
 
-        if (files.size() > 0) {
+        if ( files.size() > 0 )
+        {
 
             String base;
-    		try {
-    			base = fileSet.getBasedir().getCanonicalPath();
-    		} catch (IOException e) {
-    			throw new ScmException("Invalid canonical path", e);
-    		}
+            try
+            {
+                base = fileSet.getBasedir().getCanonicalPath();
+            }
+            catch ( IOException e )
+            {
+                throw new ScmException( "Invalid canonical path", e );
+            }
 
-	        for (Iterator i = files.iterator(); i.hasNext();) {
+            for ( Iterator i = files.iterator(); i.hasNext(); )
+            {
 
-	            Commandline command = new Commandline();
+                Commandline command = new Commandline();
 
-	            try
-	            {
-	                command.addSystemEnvironment();
-	            }
-	            catch ( Exception e )
-	            {
-	                throw new ScmException( "Can't add system environment.", e );
-	            }
+                try
+                {
+                    command.addSystemEnvironment();
+                }
+                catch ( Exception e )
+                {
+                    throw new ScmException( "Can't add system environment.", e );
+                }
 
-	            command.addEnvironment( "SSDIR", repo.getVssdir() );
+                command.addEnvironment( "SSDIR", repo.getVssdir() );
 
-	            String ssDir = VssCommandLineUtils.getSsDir();
+                String ssDir = VssCommandLineUtils.getSsDir();
 
-	            command.setExecutable( ssDir + VssConstants.SS_EXE );
+                command.setExecutable( ssDir + VssConstants.SS_EXE );
 
-	            command.createArg().setValue( VssConstants.COMMAND_CHECKIN );
-	            
-	        	File file = (File) i.next();
-				String absolute;
-				try {
-					absolute = file.getCanonicalPath();
-					String relative;
-					int index = absolute.indexOf(base);
-					if (index >= 0) {
-						relative = absolute.substring(index + base.length());
-					} else {
-						relative = file.getPath();
-					}
-					
-					relative = relative.replace('\\', '/');
-					
-					if (!relative.startsWith("/")) {
-						relative = '/' +  relative;
-					}
-					
-					String relativeFolder = relative.substring(0, relative.lastIndexOf('/'));
-					
-		            command.setWorkingDirectory( new File(fileSet.getBasedir().getAbsolutePath() + File.separatorChar + relativeFolder ).getCanonicalPath() );
-					
-		            command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() + relative);
-				} catch (IOException e) {
-					throw new ScmException("Invalid canonical path", e);
-				}
+                command.createArg().setValue( VssConstants.COMMAND_CHECKIN );
 
-	            //User identification to get access to vss repository
-	            if ( repo.getUserPassword() != null )
-	            {
-	                command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() );
-	            }
+                File file = (File) i.next();
+                String absolute;
+                try
+                {
+                    absolute = file.getCanonicalPath();
+                    String relative;
+                    int index = absolute.indexOf( base );
+                    if ( index >= 0 )
+                    {
+                        relative = absolute.substring( index + base.length() );
+                    }
+                    else
+                    {
+                        relative = file.getPath();
+                    }
 
-	    		// Ignore: Do not ask for input under any circumstances.
-	    		command.createArg().setValue(VssConstants.FLAG_AUTORESPONSE_DEF);
+                    relative = relative.replace( '\\', '/' );
 
-	    		// Ignore: Do not touch local writable files.
-	    		command.createArg().setValue(VssConstants.FLAG_REPLACE_WRITABLE);
-	    		
-	            commands.add(command);
-	        
-	        }
-        	
-        } else {
+                    if ( !relative.startsWith( "/" ) )
+                    {
+                        relative = '/' + relative;
+                    }
+
+                    String relativeFolder = relative.substring( 0, relative.lastIndexOf( '/' ) );
+
+                    command.setWorkingDirectory( new File( fileSet.getBasedir().getAbsolutePath() + File.separatorChar
+                        + relativeFolder ).getCanonicalPath() );
+
+                    command.createArg().setValue( VssConstants.PROJECT_PREFIX + repo.getProject() + relative );
+                }
+                catch ( IOException e )
+                {
+                    throw new ScmException( "Invalid canonical path", e );
+                }
+
+                //User identification to get access to vss repository
+                if ( repo.getUserPassword() != null )
+                {
+                    command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() );
+                }
+
+                // Ignore: Do not ask for input under any circumstances.
+                command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF );
+
+                // Ignore: Do not touch local writable files.
+                command.createArg().setValue( VssConstants.FLAG_REPLACE_WRITABLE );
+
+                commands.add( command );
+
+            }
+
+        }
+        else
+        {
             Commandline command = new Commandline();
 
             command.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() );
@@ -221,17 +238,17 @@
                 command.createArg().setValue( VssConstants.FLAG_LOGIN + repo.getUserPassword() );
             }
 
-    		// Ignore: Do not ask for input under any circumstances.
-    		command.createArg().setValue(VssConstants.FLAG_AUTORESPONSE_DEF);
+            // Ignore: Do not ask for input under any circumstances.
+            command.createArg().setValue( VssConstants.FLAG_AUTORESPONSE_DEF );
 
-    		// Ignore: Do not touch local writable files.
-    		command.createArg().setValue(VssConstants.FLAG_REPLACE_WRITABLE);
+            // Ignore: Do not touch local writable files.
+            command.createArg().setValue( VssConstants.FLAG_REPLACE_WRITABLE );
 
-            commands.add(command);
+            commands.add( command );
 
         }
 
         return commands;
 
-	}
+    }
 }
diff --git a/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java b/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java
index 0859c23..2b848e3 100644
--- a/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java
+++ b/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java
@@ -74,7 +74,6 @@
      */
     private static final String START_DIFFING_REMOTE = "Diffing:";
 
-
     /**
      * Marks Diffing local project folder
      */
@@ -134,11 +133,11 @@
                 lastState = DIFF_VSS_FILES_NOT_IN_CURRENT_FOLDER;
                 break;
             case DIFF_START_DIFFING_LOCAL:
-            	lastState = DIFF_START_DIFFING_LOCAL;
+                lastState = DIFF_START_DIFFING_LOCAL;
                 processLocalFolder( line );
                 break;
             case DIFF_START_DIFFING_REMOTE:
-            	lastState = DIFF_START_DIFFING_REMOTE;
+                lastState = DIFF_START_DIFFING_REMOTE;
                 processRemoteProjectFolder( line );
                 break;
             default:
@@ -149,7 +148,7 @@
 
     /**
      * 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 )
@@ -157,14 +156,17 @@
 
         if ( line != null && line.trim().length() > 0 )
         {
-            if ( lastState == DIFF_START_DIFFING_LOCAL ) {
-            	setLocalFolder(localFolder + line);
-            	getLogger().debug("Local folder: " + localFolder);
-            } else if ( lastState == DIFF_START_DIFFING_REMOTE ) {
-            	setRemoteProjectFolder(remoteProjectFolder + line);            	
-            	getLogger().debug("Remote folder: " + localFolder);
+            if ( lastState == DIFF_START_DIFFING_LOCAL )
+            {
+                setLocalFolder( localFolder + line );
+                getLogger().debug( "Local folder: " + localFolder );
             }
-        	
+            else if ( lastState == DIFF_START_DIFFING_REMOTE )
+            {
+                setRemoteProjectFolder( remoteProjectFolder + line );
+                getLogger().debug( "Remote folder: " + localFolder );
+            }
+
             String[] fileLine = line.split( " " );
             for ( int i = 0; i < fileLine.length; i++ )
             {
@@ -202,31 +204,31 @@
 
     /**
      * 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 )
     {
 
-    	setLocalFolder( line.substring( START_DIFFING_LOCAL.length() ).trim() );
+        setLocalFolder( line.substring( START_DIFFING_LOCAL.length() ).trim() );
 
     }
 
     /**
      * 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 )
     {
 
-    	setRemoteProjectFolder( line.substring( START_DIFFING_REMOTE.length() ).trim() );
+        setRemoteProjectFolder( line.substring( START_DIFFING_REMOTE.length() ).trim() );
 
     }
 
     /**
      * Identify the status of a vss get line
-     *
+     * 
      * @param line The line to process
      * @return status
      */
diff --git a/src/site/apt/synergy.apt b/src/site/apt/synergy.apt
index fc3bb23..25f538d 100644
--- a/src/site/apt/synergy.apt
+++ b/src/site/apt/synergy.apt
@@ -39,7 +39,7 @@
     For all URLs below, we use a colon (:) as separator. If you use a colon for one of the variables (e.g. a windows path), then use a pipe (|) as separator.
 
 -------
-scm:synergy<delimiter>project_name<delimiter>database_delimiter<delimiter>project_version<delimiter>release<delimiter>purpose
+scm:synergy<delimiter>project_name<delimiter>database_delimiter<delimiter>project_version<delimiter>release<delimiter>purpose<delimiter>instance
 -------
 
     <project_name>: This is the name of the project from which the checkout is done.
@@ -49,15 +49,20 @@
     <release>: This is the release.
 
     <purpose>: This is the purpose.
+	
+	<instance>: This is the (optional) instance of the project from which the checkout is done (usually a prep project). Default is 1.
 
 * Examples
 
 -------
-scm:synergy:MyProject:~:int_1.0:MyProject/2.0:Devel
-scm|synergy|MyProject|-|int_1.0|MyProject/2.0|Devel
+scm:synergy:MyProject:~:int_1.0:MyProject/2.0:Devel:1
+scm|synergy|MyProject|-|int_1.0|MyProject/2.0|Devel:db1#1
 -------
 
 * Extra Information
+** General
+
+	ccm start command shall use -rc in addition to below options for remote linux clients.
 
 ** Checkout
 
@@ -71,7 +76,7 @@
 
 -------
 ccm start -m -q -nogui -n <username> -pw <password>
-ccm query -u -f %displayname "owner='<username>' and status='working' and type='project' and has_predecessor('<project_spec>:project:1')" //Check for existing checkout
+ccm query -u -f %objectname "owner='<username>' and status='working' and type='project' and has_predecessor('<project_spec>')" //Check for existing checkout
 ccm synchronize -p <working_project_spec>
 ccm reconfigure -p <working_project_spec>
 ccm checkout -subprojects -rel [-t <tag>] -purpose <purpose> -release <release> -p <project_spec> // If no existing working project exists
@@ -84,7 +89,7 @@
 
 -------
 ccm start -m -q -nogui -n <username> -pw <password>
-ccm query -u -f %displayname "owner='<username>' and status='working' and type='project' and has_predecessor('<project_spec>:project:1')" //Check for existing checkout
+ccm query -u -f %objectname "owner='<username>' and status='working' and type='project' and has_predecessor('<project_spec>')" //Check for existing checkout
 ccm reconfigure -r -p <working_project_spec>
 ccm stop
 -------
@@ -126,7 +131,7 @@
 
 -------
 ccm start -m -q -nogui -n <username> -pw <password>
-ccm query -u is_task_in_folder_of(is_folder_in_rp_of('<project_spec>:project:1')) and completion_date>time(<startDate>) and completion_date<time(<endDate>)
+ccm query -u is_task_in_folder_of(is_folder_in_rp_of('<project_spec>')) and completion_date>time(<startDate>) and completion_date<time(<endDate>)
 ccm task -show objects <task>
 ccm stop
 -------