Commit be0ee97d authored by Jonathan Doklovic's avatar Jonathan Doklovic

Merge branch 'release/1.0-m2'

parents 2bcf55b4 e7f0e1bb
Version 1.0-m2
** Bug
* [MJF-84] - Release finish fails with merge errors
* [MJF-93] - release-finish does not commit updated snapshot versions on develop
* [MJF-103] - Finishing of feature doesn't pushes merging back into develop and the deletion of feature branch
* [MJF-151] - Error configuring remote git repo with url with enableSsAgent true on Mac OS
* [MJF-155] - RequirementHelper.requireNoExistingReleaseBranches ignores releaseBranchPrefix
* [MJF-156] - BranchHelper has a regression in getCurrentBranchType
** Epic
* [MJF-146] - Refactor JGit Flow to use Command Pattern for hooking into lifecycle
** Improvement
* [MJF-67] - Develop version on release
* [MJF-91] - Option to update develop version at release-start rather than release-end
* [MJF-150] - Refactor core commands to remove code duplication
** New Feature
* [MJF-115] - Check for 'core.autocrlf' being set to false.
* [MJF-116] - Add support for 'core.eol' GIT configuration parameter
* [MJF-147] - Implement command hooks in jgit flow library
* [MJF-148] - Implement pom updates as jgit flow commands
* [MJF-149] - Expose a way to provide external jgit flow commands to the maven plugin
=======================
Version 1.0-m1
** Bug
......
# JGit-Flow
**Current Version: 1.0-m1**
**Current Version: 1.0-m2**
**Issue Tracker Has Moved To: [https://ecosystem.atlassian.net/browse/MJF](https://ecosystem.atlassian.net/browse/MJF)**
......@@ -16,7 +16,7 @@ For more information and usage guide, [see the wiki](https://bitbucket.org/atlas
# Maven JGit-Flow Plugin
**Current Version: 1.0-m1**
**Current Version: 1.0-m2**
**The Issue Tracker Has Moved To: [https://ecosystem.atlassian.net/browse/MJF](https://ecosystem.atlassian.net/browse/MJF)**
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-parent</artifactId>
<version>1.0-m1.1</version>
<version>1.0-m2</version>
</parent>
<artifactId>jgit-flow-core</artifactId>
......@@ -35,6 +35,11 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
......@@ -53,4 +58,4 @@
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
</project>
package com.atlassian.jgitflow.core;
public enum BranchType
{
RELEASE,HOTFIX,FEATURE,DEVELOP,MASTER,SUPPORT,UNKNOWN
}
package com.atlassian.jgitflow.core;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Config.ConfigEnum;
public enum CoreEol implements ConfigEnum
{
LF("lf", "\n"),
CRLF("crlf", "\r\n"),
NATIVE("native", System.getProperty("line.separator"));
public static CoreEol DEFAULT = NATIVE;
public static final String CONFIG_KEY_EOL = "eol";
private final String configValue;
private final String eol;
private CoreEol(final String configValue, final String eol)
{
this.configValue = configValue;
this.eol = eol;
}
public String getEol()
{
return eol;
}
public static CoreEol getConfigValue ( final Config gitConfig )
{
return
gitConfig.getEnum(CoreEol.values(),
ConfigConstants.CONFIG_CORE_SECTION,
null,
CONFIG_KEY_EOL,
DEFAULT);
}
@Override
public String toConfigValue ( )
{
return configValue;
}
@Override
public boolean matchConfigValue(final String in)
{
return configValue.equalsIgnoreCase(in);
}
}
package com.atlassian.jgitflow.core;
import java.io.IOException;
import com.atlassian.jgitflow.core.exception.*;
import com.atlassian.jgitflow.core.util.GitHelper;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.util.StringUtils;
import static com.atlassian.jgitflow.core.util.Preconditions.checkState;
/**
* Start a feature.
* <p>
* This will create a new branch using the feature prefix and feature name from the tip of develop
* </p>
* <p>
* Examples (<code>flow</code> is a {@link com.atlassian.jgitflow.core.JGitFlow} instance):
* <p>
* Start a feature:
*
* <pre>
* flow.featureStart(&quot;feature&quot;).call();
* </pre>
* <p>
* Perform a fetch of develop before branching
*
* <pre>
* flow.featureStart(&quot;feature&quot;).setFetchDevelop(true).call();
* </pre>
*/
public class FeatureStartCommand extends AbstractGitFlowCommand<Ref>
{
private static final String SHORT_NAME = "feature-start";
private final String branchName;
private boolean fetchDevelop;
private boolean push;
private RevCommit startCommit;
private String startCommitString;
/**
* Create a new feature start command instance.
* <p></p>
* An instance of this class is usually obtained by calling {@link com.atlassian.jgitflow.core.JGitFlow#featureStart(String)}
* @param branchName The name of the feature
* @param git The git instance to use
* @param gfConfig The GitFlowConfiguration to use
* @param reporter
*/
FeatureStartCommand(String branchName, Git git, GitFlowConfiguration gfConfig, JGitFlowReporter reporter)
{
super(git,gfConfig, reporter);
checkState(!StringUtils.isEmptyOrNull(branchName));
this.branchName = branchName;
this.fetchDevelop = false;
this.push = false;
}
@Override
public FeatureStartCommand setAllowUntracked(boolean allow)
{
super.setAllowUntracked(allow);
return this;
}
@Override
public FeatureStartCommand setScmMessagePrefix(String scmMessagePrefix)
{
super.setScmMessagePrefix(scmMessagePrefix);
return this;
}
@Override
public FeatureStartCommand setScmMessageSuffix(String scmMessageSuffix)
{
super.setScmMessageSuffix(scmMessageSuffix);
return this;
}
/**
*
* @return A reference to the new feature branch
* @throws com.atlassian.jgitflow.core.exception.NotInitializedException
* @throws com.atlassian.jgitflow.core.exception.JGitFlowGitAPIException
* @throws com.atlassian.jgitflow.core.exception.LocalBranchExistsException
* @throws com.atlassian.jgitflow.core.exception.BranchOutOfDateException
* @throws com.atlassian.jgitflow.core.exception.JGitFlowIOException
*/
@Override
public Ref call() throws NotInitializedException, JGitFlowGitAPIException, LocalBranchExistsException, BranchOutOfDateException, JGitFlowIOException, LocalBranchMissingException, RemoteBranchExistsException
{
reporter.commandCall(SHORT_NAME);
//TODO: we should test for remote feature and pull it if it exists
final String prefixedBranchName = gfConfig.getPrefixValue(JGitFlowConstants.PREFIXES.FEATURE.configKey()) + branchName;
requireGitFlowInitialized();
requireLocalBranchAbsent(prefixedBranchName);
if(fetchDevelop)
{
RefSpec spec = new RefSpec("+" + Constants.R_HEADS + gfConfig.getDevelop() + ":" + Constants.R_REMOTES + "origin/" + gfConfig.getDevelop());
try
{
git.fetch().setRefSpecs(spec).call();
}
catch (GitAPIException e)
{
throw new JGitFlowGitAPIException(e);
}
}
try
{
//ensure local develop isn't behind remote develop
if(GitHelper.remoteBranchExists(git,gfConfig.getDevelop(), reporter))
{
requireLocalBranchNotBehindRemote(gfConfig.getDevelop());
}
RevCommit startPoint = null;
if(null != startCommit)
{
startPoint = startCommit;
}
else if(!StringUtils.isEmptyOrNull(startCommitString))
{
startPoint = GitHelper.getCommitForString(git,startCommitString);
}
else
{
startPoint = GitHelper.getLatestCommit(git, gfConfig.getDevelop());
}
requireCommitOnBranch(startPoint,gfConfig.getDevelop());
Ref newBranch = git.checkout()
.setName(prefixedBranchName)
.setCreateBranch(true)
.setStartPoint(startPoint)
.call();
if (push)
{
requireRemoteBranchAbsent(prefixedBranchName);