On Tue, Mar 31, 2009 at 10:17 AM, Imran M Yousuf <[email protected]> wrote:
> Hi,
>
> When I use the <type>tag</type> in changelog configuration (its at the
> end of the email), it uses the following query for generating the
> changeset -
>
> git whatchanged --since=0.3 --until=HEAD --date=iso
>
> While 'git help whatchanged' says nothing about '--since' but the 'git
> help log' says that '--since' is to be a date, thus IMHO, the
> implementation should have been something like -
>
> git whatchanged 0.3...HEAD --date=iso
>
> I also checked the source code of the changelog and it is using the
> following method-
>
> changeLog(ScmRepository repository, ScmFileSet fileSet, ScmVersion
> startVersion, ScmVersion endVersion)
> http://maven.apache.org/scm/projects/apidocs/org/apache/maven/scm/provider/ScmProvider.html#changeLog(org.apache.maven.scm.repository.ScmRepository,%20org.apache.maven.scm.ScmFileSet,%20org.apache.maven.scm.ScmVersion,%20org.apache.maven.scm.ScmVersion)
>
> Which IMHO, is the correct one to use. I will try to check the gitexe
> code today to see whether I can fix it or not. Please let me know what
> you think about the problem.
>
I already worked on it but was not able to compile and test it, but
this is just for RFC. Please have a look and let me know what you
think. I missed the configuration that caused the error adding it as
follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changelog-plugin</artifactId>
<version>${changelog.version}</version>
<inherited>false</inherited>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>${plexus-utils.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>attach-changelog</id>
<phase>install</phase>
<goals>
<goal>changelog</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changelog-plugin</artifactId>
<version>${changelog.version}</version>
<configuration>
<type>tag</type>
<tags>
<tag implementation="java.lang.String">0.3
</tag>
<tag implementation="java.lang.String">HEAD
</tag>
</tags>
</configuration>
</plugin>
</plugins>
</reporting>
Thank you,
Imran
> Thank you,
>
> --
> Imran M Yousuf
> Entrepreneur & Software Engineer
> Smart IT Engineering
> Dhaka, Bangladesh
> Email: [email protected]
> Blog: http://imyousuf-tech.blogs.smartitengineering.com/
> Mobile: +880-1711402557
>
--
Imran M Yousuf
Entrepreneur & Software Engineer
Smart IT Engineering
Dhaka, Bangladesh
Email: [email protected]
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557
113c113
< if ( startVersion != null || endVersion != null )
---
> if ( startVersion != null )
115,124c115
< StringBuilder builder = new StringBuilder();
< if ( startVersion != null ) {
< builder.append(startVersion.getName());
< builder.append("...");
< }
< if ( endVersion != null )
< {
< builder.append(endVersion.getName());
< }
< cl.createArg().setValue( StringUtils.escape( builder.toString() ) );
---
> cl.createArg().setValue( "--since=" + StringUtils.escape(
> startVersion.getName() ) );
131a123,130
> }
>
> if ( endVersion != null )
> {
> cl.createArg().setValue( "--until=" + StringUtils.escape(
> endVersion.getName() ) );
> }
> else
> {
138d136
<
package org.apache.maven.scm.provider.git.gitexe.command.changelog;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.scm.ScmBranch;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmVersion;
import org.apache.maven.scm.command.changelog.AbstractChangeLogCommand;
import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
import org.apache.maven.scm.command.changelog.ChangeLogSet;
import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.provider.git.command.GitCommand;
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
import org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
/**
* @author <a href="mailto:[email protected]">Emmanuel Venisse</a>
* @version $Id: GitChangeLogCommand.java 755014 2009-03-16 21:50:28Z olamy $
*/
public class GitChangeLogCommand
extends AbstractChangeLogCommand
implements GitCommand
{
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss Z";
/** {...@inheritdoc} */
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
ScmVersion startVersion, ScmVersion endVersion,
String datePattern )
throws ScmException
{
return executeChangeLogCommand( repo, fileSet, null, null, null, datePattern, startVersion, endVersion );
}
/** {...@inheritdoc} */
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
Date startDate, Date endDate, ScmBranch branch,
String datePattern )
throws ScmException
{
return executeChangeLogCommand( repo, fileSet, startDate, endDate, branch, datePattern, null, null );
}
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
Date startDate, Date endDate, ScmBranch branch,
String datePattern, ScmVersion startVersion,
ScmVersion endVersion )
throws ScmException
{
Commandline cl = createCommandLine( (GitScmProviderRepository) repo, fileSet.getBasedir(), branch, startDate,
endDate, startVersion, endVersion );
GitChangeLogConsumer consumer = new GitChangeLogConsumer( getLogger(), datePattern );
CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
int exitCode;
exitCode = GitCommandLineUtils.execute( cl, consumer, stderr, getLogger() );
if ( exitCode != 0 )
{
return new ChangeLogScmResult( cl.toString(), "The git-log command failed.", stderr.getOutput(), false );
}
ChangeLogSet changeLogSet = new ChangeLogSet( consumer.getModifications(), startDate, endDate );
changeLogSet.setStartVersion( startVersion );
changeLogSet.setEndVersion( endVersion );
return new ChangeLogScmResult( cl.toString(), changeLogSet );
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
/**
* @TODO branch handling
*/
public static Commandline createCommandLine( GitScmProviderRepository repository, File workingDirectory,
ScmBranch branch, Date startDate, Date endDate,
ScmVersion startVersion, ScmVersion endVersion )
{
SimpleDateFormat dateFormat = new SimpleDateFormat( DATE_FORMAT );
dateFormat.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "whatchanged" );
if ( startVersion != null || endVersion != null )
{
StringBuilder builder = new StringBuilder();
if ( startVersion != null ) {
builder.append(startVersion.getName());
builder.append("...");
}
if ( endVersion != null )
{
builder.append(endVersion.getName());
}
cl.createArg().setValue( StringUtils.escape( builder.toString() ) );
}
else
{
if ( startDate != null )
{
cl.createArg().setValue( "--since=" + StringUtils.escape( dateFormat.format( startDate ) ) );
}
if ( endDate != null )
{
cl.createArg().setValue( "--until=" + StringUtils.escape( dateFormat.format( endDate ) ) );
}
}
cl.createArg().setValue( "--date=iso" );
return cl;
}
}