maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r344103 - in /maven/scm/trunk: maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/changelog/ maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/...
Date Mon, 14 Nov 2005 11:16:00 GMT
Author: evenisse
Date: Mon Nov 14 03:15:46 2005
New Revision: 344103

URL: http://svn.apache.org/viewcvs?rev=344103&view=rev
Log:
PR: SCM-72
Submitted by : David Hawkins
Reviewed by : Emmanuel Venisse

On the SvnChangeLogCommand command, I changed the date format specified in the command line.
The original format looked like: svn log -v -r "{2003/09/10 GMT}:{2003/10/10 GMT}"
But this format was not legal in svn version 1.2.3 on cygwin, linux, or windows. I am not
sure if a previous version supported this date format, but the current does not.
The new date format looks like: svn log -v -r "{2003-09-10 00:00:00 +0000}:{2003-10-10 00:00:00
+0000}"
It is now specifying the time along with the date. The api allows a user to pass a date, so
we should probably use the time in the date as well.
I also changed ScmTestCase.getDate() to support passing time values so I could test the changelog
command creation.

Modified:
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/checkout/SvnCheckOutCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommand.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepository.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommandTest.java
    maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommandTckTest.java
    maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommand.java?rev=344103&r1=344102&r2=344103&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommand.java
Mon Nov 14 03:15:46 2005
@@ -21,6 +21,7 @@
 import org.apache.maven.scm.command.changelog.AbstractChangeLogCommand;
 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.SvnTagBranchUtils;
 import org.apache.maven.scm.provider.svn.command.SvnCommand;
 import org.apache.maven.scm.provider.svn.command.SvnCommandLineUtils;
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
@@ -41,7 +42,7 @@
     extends AbstractChangeLogCommand
     implements SvnCommand
 {
-    private final static String DATE_FORMAT = "yyyy/MM/dd 'GMT'";
+    private final static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss Z";
 
     protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet
fileSet,
                                                           Date startDate, Date endDate, int
numDays, String branch )
@@ -92,6 +93,8 @@
         cl.createArgument().setValue( "log" );
 
         cl.createArgument().setValue( "-v" );
+        
+        // TODO: May want to add some kind of support for --stop-on-copy and --limit NUM
 
         if ( startDate != null )
         {
@@ -107,15 +110,14 @@
                 cl.createArgument().setValue( "{" + dateFormat.format( startDate ) + "}:HEAD"
);
             }
         }
-        else
+        
+        if ( branch != null )
         {
-            if ( branch != null )
-            {
-                cl.createArgument().setValue( "-r" );
-                cl.createArgument().setValue( branch );
-            }
+            // By specifying a branch and this repository url below, subversion should show

+            // the changelog of that branch, but limit it to paths that also occur in this
repository.
+            cl.createArgument().setValue( SvnTagBranchUtils.resolveBranchUrl( repository,
branch ) );
         }
-
+        
         cl.createArgument().setValue( repository.getUrl() );
 
         return cl;

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/checkout/SvnCheckOutCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/checkout/SvnCheckOutCommand.java?rev=344103&r1=344102&r2=344103&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/checkout/SvnCheckOutCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/checkout/SvnCheckOutCommand.java
Mon Nov 14 03:15:46 2005
@@ -21,6 +21,7 @@
 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.svn.SvnTagBranchUtils;
 import org.apache.maven.scm.provider.svn.command.SvnCommand;
 import org.apache.maven.scm.provider.svn.command.SvnCommandLineUtils;
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
@@ -46,13 +47,7 @@
         String url = repository.getUrl();
         if ( tag != null )
         {
-            String tagBase = repository.getTagBase();
-
-            if ( tagBase == null )
-            {
-                throw new ScmException( "tag base must be specified" );
-            }
-            url = tagBase + "/" + tag;
+            url = SvnTagBranchUtils.resolveTagUrl( repository, tag );
         }
 
         // TODO: revision

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommand.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommand.java?rev=344103&r1=344102&r2=344103&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommand.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommand.java
Mon Nov 14 03:15:46 2005
@@ -16,6 +16,12 @@
  * limitations under the License.
  */
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import org.apache.maven.scm.ScmException;
 import org.apache.maven.scm.ScmFile;
 import org.apache.maven.scm.ScmFileSet;
@@ -24,6 +30,7 @@
 import org.apache.maven.scm.command.tag.AbstractTagCommand;
 import org.apache.maven.scm.command.tag.TagScmResult;
 import org.apache.maven.scm.provider.ScmProviderRepository;
+import org.apache.maven.scm.provider.svn.SvnTagBranchUtils;
 import org.apache.maven.scm.provider.svn.command.SvnCommand;
 import org.apache.maven.scm.provider.svn.command.SvnCommandLineUtils;
 import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
@@ -32,12 +39,6 @@
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 import org.codehaus.plexus.util.cli.Commandline;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
@@ -62,12 +63,6 @@
 
         SvnScmProviderRepository repository = (SvnScmProviderRepository) repo;
 
-        String tagBase = repository.getTagBase();
-        if ( tagBase == null )
-        {
-            throw new ScmException( "tag base must be specified" );
-        }
-
         File messageFile = FileUtils.createTempFile( "maven-scm-", ".commit", null );
 
         try
@@ -81,7 +76,7 @@
                                      null, false );
         }
 
-        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), tagBase, tag,
messageFile );
+        Commandline cl = createCommandLine( repository, fileSet.getBasedir(), tag, messageFile
);
 
         CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
 
@@ -132,7 +127,7 @@
     // ----------------------------------------------------------------------
 
     private static Commandline createCommandLine( SvnScmProviderRepository repository, File
workingDirectory,
-                                                  String tagBase, String tag, File messageFile
)
+                                                  String tag, File messageFile )
     {
         Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine( workingDirectory, repository
);
 
@@ -145,7 +140,7 @@
         cl.createArgument().setValue( "." );
 
         // Note: this currently assumes you have the tag base checked out too
-        cl.createArgument().setValue( tagBase + "/" + tag );
+        cl.createArgument().setValue( SvnTagBranchUtils.resolveTagUrl( repository, tag )
);
 
         return cl;
     }

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepository.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepository.java?rev=344103&r1=344102&r2=344103&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepository.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/main/java/org/apache/maven/scm/provider/svn/repository/SvnScmProviderRepository.java
Mon Nov 14 03:15:46 2005
@@ -29,7 +29,7 @@
     private String url;
 
     /**
-     * The base directory for any tags, relative to the URL given. Default is <code>../tags</code>.
+     * The base directory for any tags. Can be relative to the repository URL or an absolute
URL. 
      */
     private String tagBase;
 
@@ -61,9 +61,10 @@
      * The TagBase is a way to override the default tag location for the 
      * repository.  The default tag location is automatically determined 
      * for repositories in the standard subversion layout (with /tags /branches /trunk).

+     * Specify this value only if the repository is using a directory other than "/tags"
for tagging.
      *
      * @param tagBase  an absolute or relative url to the base directory to create tags in.

-     *                 Should not be in a format that svn client understands, not the scm
url format.
+     *                 URL should be in a format that svn client understands, not the scm
url format.
      */
     public void setTagBase( String tagBase )
     {

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommandTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommandTest.java?rev=344103&r1=344102&r2=344103&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommandTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/changelog/SvnChangeLogCommandTest.java
Mon Nov 14 03:15:46 2005
@@ -22,6 +22,7 @@
 import org.codehaus.plexus.util.cli.Commandline;
 
 import java.io.File;
+import java.util.Calendar;
 import java.util.Date;
 
 /**
@@ -31,21 +32,99 @@
 public class SvnChangeLogCommandTest
     extends ScmTestCase
 {
-    public void testCommandLine()
+    public void testCommandLineNoDates()
         throws Exception
     {
-        Date startDate = getDate( 2003, 8, 10, GMT_TIME_ZONE );
-        Date endDate = getDate( 2003, 9, 10, GMT_TIME_ZONE );
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, null, null,
+                         "svn --non-interactive log -v http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineWithDates()
+        throws Exception
+    {
+        Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, GMT_TIME_ZONE );
+        Date endDate = getDate( 2003, Calendar.OCTOBER, 10, GMT_TIME_ZONE );
+
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, startDate, endDate,
+                         "svn --non-interactive log -v -r \"{2003-09-10 00:00:00 +0000}:{2003-10-10
00:00:00 +0000}\" http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineStartDateOnly()
+        throws Exception
+    {
+        Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, startDate, null,
+                         "svn --non-interactive log -v -r \"{2003-09-10 01:01:01 +0000}:HEAD\"
http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineDateFormat()
+        throws Exception
+    {
+        Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+        Date endDate = getDate( 2005, Calendar.NOVEMBER, 13, 23, 23, 23, GMT_TIME_ZONE );
 
         testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, startDate, endDate,
-                         "svn --non-interactive log -v -r \"{2003/09/10 GMT}:{2003/10/10
GMT}\" http://foo.com/svn/trunk" );
+                         "svn --non-interactive log -v -r \"{2003-09-10 01:01:01 +0000}:{2005-11-13
23:23:23 +0000}\" http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineEndDateOnly()
+        throws Exception
+    {
+        Date endDate = getDate( 2003, Calendar.NOVEMBER, 10, GMT_TIME_ZONE );
+
+        // Only specifying end date should print no dates at all
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", null, null, endDate,
+                         "svn --non-interactive log -v http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineWithBranchNoDates()
+        throws Exception
+    {
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", "my-test-branch", null, null,
+                         "svn --non-interactive log -v http://foo.com/svn/branches/my-test-branch
http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineWithBranchStartDateOnly()
+        throws Exception
+    {
+        Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk",
+                         "my-test-branch",
+                         startDate,
+                         null,
+                         "svn --non-interactive log -v -r \"{2003-09-10 01:01:01 +0000}:HEAD\"
http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineWithBranchEndDateOnly()
+        throws Exception
+    {
+        Date endDate = getDate( 2003, Calendar.OCTOBER, 10, 1, 1, 1, GMT_TIME_ZONE );
+
+        // Only specifying end date should print no dates at all
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk", "my-test-branch", null, endDate,
+                         "svn --non-interactive log -v http://foo.com/svn/branches/my-test-branch
http://foo.com/svn/trunk" );
+    }
+
+    public void testCommandLineWithBranchBothDates()
+        throws Exception
+    {
+        Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, GMT_TIME_ZONE );
+        Date endDate = getDate( 2003, Calendar.OCTOBER, 10, GMT_TIME_ZONE );
+
+        testCommandLine( "scm:svn:http://foo.com/svn/trunk",
+                         "my-test-branch",
+                         startDate,
+                         endDate,
+                         "svn --non-interactive log -v -r \"{2003-09-10 00:00:00 +0000}:{2003-10-10
00:00:00 +0000}\" http://foo.com/svn/branches/my-test-branch http://foo.com/svn/trunk" );
     }
 
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
 
-    private void testCommandLine( String scmUrl, String tag, Date startDate, Date endDate,
String commandLine )
+    private void testCommandLine( String scmUrl, String branch, Date startDate, Date endDate,
String commandLine )
         throws Exception
     {
         File workingDirectory = getTestFile( "target/svn-update-command-test" );
@@ -54,7 +133,7 @@
 
         SvnScmProviderRepository svnRepository = (SvnScmProviderRepository) repository.getProviderRepository();
 
-        Commandline cl = SvnChangeLogCommand.createCommandLine( svnRepository, workingDirectory,
tag, startDate,
+        Commandline cl = SvnChangeLogCommand.createCommandLine( svnRepository, workingDirectory,
branch, startDate,
                                                                 endDate );
 
         assertEquals( commandLine, cl.toString() );

Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommandTckTest.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommandTckTest.java?rev=344103&r1=344102&r2=344103&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommandTckTest.java
(original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-svn/src/test/java/org/apache/maven/scm/provider/svn/command/tag/SvnTagCommandTckTest.java
Mon Nov 14 03:15:46 2005
@@ -16,14 +16,11 @@
  * limitations under the License.
  */
 
-import org.apache.maven.scm.manager.ScmManager;
+import java.io.File;
+
 import org.apache.maven.scm.provider.svn.SvnScmTestUtils;
-import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
-import org.apache.maven.scm.repository.ScmRepository;
 import org.apache.maven.scm.tck.command.tag.TagCommandTckTest;
 
-import java.io.File;
-
 /**
  * This test tests the tag command.
  *
@@ -37,16 +34,7 @@
     {
         return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
     }
-
-    protected ScmRepository getScmRepository( ScmManager scmManager )
-        throws Exception
-    {
-        ScmRepository repo = super.getScmRepository( scmManager );
-        SvnScmProviderRepository repository = (SvnScmProviderRepository) repo.getProviderRepository();
-        repository.setTagBase( SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(),
"tags" ) ).substring( "scm:svn:".length() ) );
-        return repo;
-    }
-
+    
     public void initRepo()
         throws Exception
     {

Modified: maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java
URL: http://svn.apache.org/viewcvs/maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java?rev=344103&r1=344102&r2=344103&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java (original)
+++ maven/scm/trunk/maven-scm-test/src/main/java/org/apache/maven/scm/ScmTestCase.java Mon
Nov 14 03:15:46 2005
@@ -216,22 +216,25 @@
 
     public static Date getDate( int year, int month, int day )
     {
-        Calendar cal = Calendar.getInstance();
-
-        cal.set( year, month, day, 0, 0, 0 );
-        cal.set( Calendar.MILLISECOND, 0 );
-
-        return cal.getTime();
+        return getDate(year, month, day, 0, 0, 0, null);
     }
 
     protected static Date getDate( int year, int month, int day, TimeZone tz )
     {
+        return getDate(year, month, day, 0, 0, 0, tz);
+    }
+    
+    protected static Date getDate( int year, int month, int day, int hourOfDay, int minute,
int second, TimeZone tz )
+    {
         Calendar cal = Calendar.getInstance();
-
-        cal.setTimeZone( tz );
-        cal.set( year, month, day, 0, 0, 0 );
+        
+        if ( tz != null )
+        {
+            cal.setTimeZone( tz );
+        }
+        cal.set( year, month, day, hourOfDay, minute, second );
         cal.set( Calendar.MILLISECOND, 0 );
-
+        
         return cal.getTime();
     }
 }



Mime
View raw message