maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mper...@apache.org
Subject svn commit: r431520 - in /maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce: PerforceScmProvider.java command/tag/PerforceTagCommand.java
Date Tue, 15 Aug 2006 03:51:11 GMT
Author: mperham
Date: Mon Aug 14 20:51:11 2006
New Revision: 431520

URL: http://svn.apache.org/viewvc?rev=431520&view=rev
Log:
PR: SCM-226
Lock any created tag by default.  This is the desired behavior with the release plugin.
Use "-Dmaven.scm.locktag=false" to disable locking.

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java?rev=431520&r1=431519&r2=431520&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/PerforceScmProvider.java
Mon Aug 14 20:51:11 2006
@@ -388,6 +388,8 @@
 
     private static String getUsername( PerforceScmProviderRepository repo )
     {
+        // TODO Need to use PeforceInfoCommand here.
+        // os user != perforce user
         String username = repo.getUser();
         if ( username == null )
         {

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java?rev=431520&r1=431519&r2=431520&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-perforce/src/main/java/org/apache/maven/scm/provider/perforce/command/tag/PerforceTagCommand.java
Mon Aug 14 20:51:11 2006
@@ -51,11 +51,20 @@
         throws ScmException
     {
         PerforceTagConsumer consumer = new PerforceTagConsumer();
-        createLabel( repo, files, tag, consumer );
+        createLabel( repo, files, tag, consumer, false );
         if ( consumer.isSuccess() )
         {
             syncLabel( repo, files, tag, consumer );
         }
+        if ( consumer.isSuccess() )
+        {
+            // Now update the label if we need to lock it
+            if ( shouldLock() )
+            {
+                consumer = new PerforceTagConsumer();
+                createLabel( repo, files, tag, consumer, true );
+            }
+        }
 
         if ( consumer.isSuccess() )
         {
@@ -69,6 +78,11 @@
         }
     }
 
+    private boolean shouldLock()
+    {
+        return Boolean.getBoolean( System.getProperty( "maven.scm.locktag", "true" ) );
+    }
+
     private void syncLabel( ScmProviderRepository repo, ScmFileSet files, String tag, PerforceTagConsumer
consumer )
     {
         Commandline cl =
@@ -95,7 +109,7 @@
         }
     }
 
-    private void createLabel( ScmProviderRepository repo, ScmFileSet files, String tag, PerforceTagConsumer
consumer )
+    private void createLabel( ScmProviderRepository repo, ScmFileSet files, String tag, PerforceTagConsumer
consumer, boolean lock )
     {
         Commandline cl = createLabelCommandLine( (PerforceScmProviderRepository) repo, files.getBasedir()
);
         try
@@ -104,7 +118,7 @@
             Process proc = cl.execute();
             OutputStream out = proc.getOutputStream();
             DataOutputStream dos = new DataOutputStream( out );
-            String label = createLabelSpecification( (PerforceScmProviderRepository) repo,
tag );
+            String label = createLabelSpecification( (PerforceScmProviderRepository) repo,
tag, lock );
             dos.write( label.getBytes() );
             dos.close();
             out.close();
@@ -160,7 +174,7 @@
      * View: //depot/path/to/repos/...
      * Owner: mperham
      */
-    public String createLabelSpecification( PerforceScmProviderRepository repo, String tag
)
+    public String createLabelSpecification( PerforceScmProviderRepository repo, String tag,
boolean lock )
     {
         StringBuffer buf = new StringBuffer();
         buf.append( "Label: " ).append( tag ).append( NEWLINE );
@@ -173,6 +187,7 @@
             username = PerforceInfoCommand.getInfo( this, repo ).getEntry( "User name" );
         }
         buf.append( "Owner: " ).append( username ).append( NEWLINE );
+        buf.append( "Options: " ).append( lock ? "" : "un" ).append( "locked" ).append( NEWLINE
);
         return buf.toString();
     }
 }



Mime
View raw message