maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r897657 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands: checkin/VssCheckInCommand.java status/VssStatusConsumer.java
Date Sun, 10 Jan 2010 16:38:33 GMT
Author: olamy
Date: Sun Jan 10 16:38:32 2010
New Revision: 897657

URL: http://svn.apache.org/viewvc?rev=897657&view=rev
Log:
fix some minor checkstyle issues.

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java?rev=897657&r1=897656&r2=897657&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/checkin/VssCheckInCommand.java
Sun Jan 10 16:38:32 2010
@@ -42,22 +42,22 @@
  * @since 1.3
  * 
  */
-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
+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
     {
-		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);
-    		}
-
-	        for (Iterator i = files.iterator(); i.hasNext();) {
-
-	            Commandline command = new Commandline();
-
-	            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.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);
-				}
-
-	            //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 {
+            try
+            {
+                base = fileSet.getBasedir().getCanonicalPath();
+            }
+            catch ( IOException e )
+            {
+                throw new ScmException( "Invalid canonical path", e );
+            }
+
+            for ( Iterator i = files.iterator(); i.hasNext(); )
+            {
+
+                Commandline command = new Commandline();
+
+                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.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 );
+                }
+
+                //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;
 
-	}
+    }
 }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java?rev=897657&r1=897656&r2=897657&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-vss/src/main/java/org/apache/maven/scm/provider/vss/commands/status/VssStatusConsumer.java
Sun Jan 10 16:38:32 2010
@@ -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
      */



Mime
View raw message