You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-commits@maven.apache.org by ol...@apache.org on 2009/04/30 00:31:23 UTC
svn commit: r769975 - in
/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src:
main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/
test/java/org/apache/maven/scm/provider/git/gitexe/command/change...
Author: olamy
Date: Wed Apr 29 22:31:22 2009
New Revision: 769975
URL: http://svn.apache.org/viewvc?rev=769975&view=rev
Log:
[SCM-458] GitChangeLogCommand always reports over the whole git repo - also for child modules
Submitted by Mark Struberg
Modified:
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java?rev=769975&r1=769974&r2=769975&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/main/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommand.java Wed Apr 29 22:31:22 2009
@@ -149,12 +149,19 @@
}
-
if ( branch != null && branch.getName() != null && branch.getName().length() > 0 )
{
cl.createArg().setValue( branch.getName() );
}
+ // Insert a separator to make sure that files aren't interpreted as part of the version spec
+ cl.createArg().setValue( "--" );
+
+ // We have to report only the changes of the current project.
+ // This is needed for child projects, otherwise we would get the changelog of the
+ // whole parent-project including all childs.
+ cl.createArg().setFile( workingDirectory );
+
return cl;
}
}
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java?rev=769975&r1=769974&r2=769975&view=diff
==============================================================================
--- maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java (original)
+++ maven/scm/trunk/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-gitexe/src/test/java/org/apache/maven/scm/provider/git/gitexe/command/changelog/GitChangeLogCommandTest.java Wed Apr 29 22:31:22 2009
@@ -38,11 +38,22 @@
public class GitChangeLogCommandTest
extends ScmTestCase
{
+ private File workingDirectory;
+
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ workingDirectory = getTestFile( "target/git-update-command-test" );
+ }
+
public void testCommandLineNoDates()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", null, (Date) null, (Date) null,
- "git whatchanged --date=iso" );
+ "git whatchanged --date=iso"
+ + " -- " + workingDirectory );
}
public void testCommandLineWithDates()
@@ -52,7 +63,8 @@
Date endDate = getDate( 2007, Calendar.OCTOBER, 10, GMT_TIME_ZONE );
testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate,
- "git whatchanged \"--since=2003-09-10 00:00:00 +0000\" \"--until=2007-10-10 00:00:00 +0000\" --date=iso" );
+ "git whatchanged \"--since=2003-09-10 00:00:00 +0000\" \"--until=2007-10-10 00:00:00 +0000\" --date=iso"
+ + " -- " + workingDirectory );
}
public void testCommandLineStartDateOnly()
@@ -61,7 +73,8 @@
Date startDate = getDate( 2003, Calendar.SEPTEMBER, 10, 1, 1, 1, GMT_TIME_ZONE );
testCommandLine( "scm:git:http://foo.com/git", null, startDate, null,
- "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" --date=iso" );
+ "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" --date=iso"
+ + " -- " + workingDirectory );
}
public void testCommandLineDateFormat()
@@ -71,7 +84,8 @@
Date endDate = getDate( 2005, Calendar.NOVEMBER, 13, 23, 23, 23, GMT_TIME_ZONE );
testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate,
- "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso" );
+ "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso"
+ + " -- " + workingDirectory );
}
public void testCommandLineDateVersionRanges()
@@ -81,7 +95,8 @@
Date endDate = getDate( 2005, Calendar.NOVEMBER, 13, 23, 23, 23, GMT_TIME_ZONE );
testCommandLine( "scm:git:http://foo.com/git", null, startDate, endDate, new ScmRevision( "1" ), new ScmRevision( "10" ),
- "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso 1..10" );
+ "git whatchanged \"--since=2003-09-10 01:01:01 +0000\" \"--until=2005-11-13 23:23:23 +0000\" --date=iso 1..10"
+ + " -- " + workingDirectory );
}
public void testCommandLineEndDateOnly()
@@ -91,14 +106,16 @@
// Only specifying end date should print no dates at all
testCommandLine( "scm:git:http://foo.com/git", null, null, endDate,
- "git whatchanged \"--until=2003-11-10 00:00:00 +0000\" --date=iso" );
+ "git whatchanged \"--until=2003-11-10 00:00:00 +0000\" --date=iso"
+ + " -- " + workingDirectory );
}
public void testCommandLineWithBranchNoDates()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", new ScmBranch( "my-test-branch" ), (Date) null, (Date) null,
- "git whatchanged --date=iso my-test-branch" );
+ "git whatchanged --date=iso my-test-branch"
+ + " -- " + workingDirectory );
}
@@ -106,28 +123,32 @@
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), null,
- "git whatchanged --date=iso 1.." );
+ "git whatchanged --date=iso 1.."
+ + " -- " + workingDirectory );
}
public void testCommandLineWithStartVersionAndEndVersion()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), new ScmRevision( "10" ),
- "git whatchanged --date=iso 1..10" );
+ "git whatchanged --date=iso 1..10"
+ + " -- " + workingDirectory );
}
public void testCommandLineWithStartVersionAndEndVersionEquals()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", null, new ScmRevision( "1" ), new ScmRevision( "1" ),
- "git whatchanged --date=iso 1..1" );
+ "git whatchanged --date=iso 1..1"
+ + " -- " + workingDirectory );
}
public void testCommandLineWithStartVersionAndEndVersionAndBranch()
throws Exception
{
testCommandLine( "scm:git:http://foo.com/git", new ScmBranch( "my-test-branch" ), new ScmRevision( "1" ), new ScmRevision( "10" ),
- "git whatchanged --date=iso 1..10 my-test-branch" );
+ "git whatchanged --date=iso 1..10 my-test-branch"
+ + " -- " + workingDirectory );
}
// ----------------------------------------------------------------------
@@ -137,8 +158,6 @@
private void testCommandLine( String scmUrl, ScmBranch branch, Date startDate, Date endDate, String commandLine )
throws Exception
{
- File workingDirectory = getTestFile( "target/git-update-command-test" );
-
ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
GitScmProviderRepository gitRepository = (GitScmProviderRepository) repository.getProviderRepository();
@@ -152,8 +171,6 @@
private void testCommandLine( String scmUrl, ScmBranch branch, ScmVersion startVersion, ScmVersion endVersion, String commandLine )
throws Exception
{
- File workingDirectory = getTestFile( "target/git-update-command-test" );
-
ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
GitScmProviderRepository gitRepository = (GitScmProviderRepository) repository.getProviderRepository();
@@ -168,8 +185,6 @@
ScmVersion startVersion, ScmVersion endVersion, String commandLine )
throws Exception
{
- File workingDirectory = getTestFile( "target/git-update-command-test" );
-
ScmRepository repository = getScmManager().makeScmRepository( scmUrl );
GitScmProviderRepository gitRepository = (GitScmProviderRepository) repository.getProviderRepository();