Skip to content

Commit

Permalink
[SCM-948] Make limit parameter work for svnexe and gitexe changelog goal
Browse files Browse the repository at this point in the history
This closes #119
  • Loading branch information
cquoss authored and michael-o committed Aug 5, 2021
1 parent a434fe6 commit 4cafe0f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.apache.maven.scm.CommandParameter;
import org.apache.maven.scm.CommandParameters;
import org.apache.maven.scm.ScmResult;

/**
* @author <a href="mailto:[email protected]">Emmanuel Venisse</a>
Expand All @@ -51,7 +54,24 @@ public class GitChangeLogCommand
{
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss Z";

@Override
public ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
return executeChangeLogCommand( repository, fileSet,
parameters.getDate( CommandParameter.START_DATE, null ),
parameters.getDate( CommandParameter.END_DATE, null ),
(ScmBranch) parameters.getScmVersion( CommandParameter.BRANCH, null ),
parameters.getString( CommandParameter.CHANGELOG_DATE_PATTERN, null ),
parameters.getScmVersion( CommandParameter.START_SCM_VERSION, null ),
parameters.getScmVersion( CommandParameter.END_SCM_VERSION, null ),
parameters.getInt( CommandParameter.LIMIT, -1 ),
parameters.getScmVersion( CommandParameter.SCM_VERSION, null ) );
}

/** {@inheritDoc} */
@Override
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
ScmVersion startVersion, ScmVersion endVersion,
String datePattern )
Expand All @@ -61,6 +81,7 @@ protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo
}

/** {@inheritDoc} */
@Override
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
Date startDate, Date endDate, ScmBranch branch,
String datePattern )
Expand Down Expand Up @@ -148,9 +169,19 @@ protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo
// ----------------------------------------------------------------------

/**
* this constructs creates the commandline for the git-whatchanged command.
* This method creates the commandline for the git-whatchanged command.
* <p>
* Since it uses --since and --until for the start and end date, the branch
* and version parameters can be used simultanously.
*
* @param repository Provider repositry to use.
* @param workingDirectory Working copy directory.
* @param branch Branch to run command on.
* @param startDate Start date of log entries.
* @param endDate End date of log entries.
* @param startVersion Start version of log entries.
* @param endVersion End version of log entries.
* @return Command line.
*/
public static Commandline createCommandLine( GitScmProviderRepository repository, File workingDirectory,
ScmBranch branch, Date startDate, Date endDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
import java.util.Date;
import java.util.Objects;
import java.util.TimeZone;
import org.apache.maven.scm.CommandParameter;
import org.apache.maven.scm.CommandParameters;
import org.apache.maven.scm.ScmResult;

/**
* @author <a href="mailto:[email protected]">Emmanuel Venisse</a>
Expand All @@ -56,8 +59,24 @@ public class SvnChangeLogCommand
{
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss Z";

@Override
public ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet,
CommandParameters parameters )
throws ScmException
{
return executeChangeLogCommand( repository, fileSet,
parameters.getDate( CommandParameter.START_DATE, null ),
parameters.getDate( CommandParameter.END_DATE, null ),
(ScmBranch) parameters.getScmVersion( CommandParameter.BRANCH, null ),
parameters.getString( CommandParameter.CHANGELOG_DATE_PATTERN, null ),
parameters.getScmVersion( CommandParameter.START_SCM_VERSION, null ),
parameters.getScmVersion( CommandParameter.END_SCM_VERSION, null ),
parameters.getInt( CommandParameter.LIMIT, -1 ) );
}

/** {@inheritDoc} */
@Deprecated
@Override
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
ScmVersion startVersion, ScmVersion endVersion,
String datePattern )
Expand All @@ -68,6 +87,7 @@ protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo

/** {@inheritDoc} */
@Deprecated
@Override
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet,
Date startDate, Date endDate, ScmBranch branch,
String datePattern )
Expand Down

0 comments on commit 4cafe0f

Please sign in to comment.