Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
/**
* Git flow {@link org.apache.maven.shared.release.versions.VersionInfo}
* implementation. Adds few convenient methods.
*
*
*/
public class GitFlowVersionInfo extends DefaultVersionInfo {

private final VersionPolicy versionPolicy;

public GitFlowVersionInfo(final String version, final VersionPolicy versionPolicy)
Expand All @@ -42,7 +42,7 @@ public GitFlowVersionInfo(final String version, final VersionPolicy versionPolic

/**
* Returns a new GitFlowVersionInfo that holds only digits in the version.
*
*
* @return Digits only GitFlowVersionInfo instance.
* @throws VersionParseException
* If version parsing fails.
Expand All @@ -53,7 +53,7 @@ public GitFlowVersionInfo digitsVersionInfo() throws VersionParseException {

/**
* Validates version.
*
*
* @param version
* Version to validate.
* @return <code>true</code> when version is valid, <code>false</code>
Expand All @@ -80,7 +80,7 @@ public String getReleaseVersionString() {

/**
* Gets next SNAPSHOT version.
*
*
* @return Next SNAPSHOT version.
*/
public String nextSnapshotVersion() {
Expand All @@ -89,7 +89,7 @@ public String nextSnapshotVersion() {

/**
* Gets next SNAPSHOT version.
*
*
* @param index
* Which part of version to increment.
* @return Next SNAPSHOT version.
Expand All @@ -101,7 +101,7 @@ public String nextSnapshotVersion(final Integer index) {
/**
* Gets next version. If index is <code>null</code> or not valid then it
* delegates to {@link #getNextVersion()} method.
*
*
* @param index
* Which part of version to increment.
* @param snapshot
Expand Down Expand Up @@ -147,23 +147,28 @@ private String nextVersion(final Integer index, boolean snapshot) {

/**
* Gets version with appended feature name.
*
*
* @param featureName
* Feature name to append.
* @return Version with appended feature name.
*/
public String featureVersion(final String featureName) {
String version = toString();
if (featureName != null) {
version = getReleaseVersionString() + "-" + featureName
version = getReleaseVersionString() + "-" + getCleanedFeatureName(featureName)
+ (isSnapshot() ? "-" + Artifact.SNAPSHOT_VERSION : "");
}
return version;
}

public static String getCleanedFeatureName(String featureName) {
String cleanedFeatureName = featureName.replaceAll("[\\\\/:\"<>|?*]", "-");
return cleanedFeatureName.replaceAll("-+", "-");
}

/**
* Gets next hotfix version.
*
*
* @param preserveSnapshot
* Whether to preserve SNAPSHOT in the version.
* @param index
Expand Down