-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add branch change tasks to allow for gitflow releasing #191
Open
jakehschwartz
wants to merge
13
commits into
sbt:master
Choose a base branch
from
jakehschwartz:branch-switching-tasks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
897bd27
Add branch change tasks to allow for gitflow releasing
jakehschwartz 02d9b84
Added parens around branch command
jakehschwartz 8116761
Scripted test for gitflow and cli params for release and next branches
jakehschwartz c70b7db
Copied over test task to gitflow/build.sbt
jakehschwartz ad29693
Allow new branches to be created based on the current tracking remote…
jakehschwartz dc77de8
Fix compilation error
jakehschwartz ff80dec
Change logic for determining new branch
jakehschwartz 4b56ca9
Merge branch 'master' into branch-switching-tasks
jakehschwartz 610c71c
Documentation for gitflow
jakehschwartz 51b85ec
Documentation for gitflow
jakehschwartz dbd3e27
Fix scripted test for gitflow
jakehschwartz 1913b4b
Merge branch 'master' into branch-switching-tasks
jakehschwartz cfdbdca
Merge branch 'master' into branch-switching-tasks
jakehschwartz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ trait Vcs { | |
def isBehindRemote: Boolean | ||
def pushChanges: ProcessBuilder | ||
def currentBranch: String | ||
def setBranch(branch: String): ProcessBuilder | ||
def newBranch(branch: String): ProcessBuilder | ||
def hasUntrackedFiles: Boolean | ||
def hasModifiedFiles: Boolean | ||
|
||
|
@@ -106,6 +108,11 @@ class Mercurial(val baseDir: File) extends Vcs with GitLike { | |
|
||
def currentBranch = (cmd("branch") !!) trim | ||
|
||
// FIXME: Need help here | ||
def setBranch(branch: String) = cmd("branch", branch) | ||
|
||
def newBranch(branch: String) = setBranch(branch) | ||
|
||
// FIXME: This is utterly bogus, but I cannot find a good way... | ||
def checkRemote(remote: String) = cmd("id", "-n") | ||
|
||
|
@@ -134,6 +141,10 @@ class Git(val baseDir: File) extends Vcs with GitLike { | |
|
||
def currentBranch = (cmd("symbolic-ref", "HEAD") !!).trim.stripPrefix("refs/heads/") | ||
|
||
def setBranch(branch: String) = cmd("checkout", branch) | ||
|
||
def newBranch(branch: String) = cmd("checkout", "-b", branch) | ||
|
||
def currentHash = revParse("HEAD") | ||
|
||
private def revParse(name: String) = (cmd("rev-parse", name) !!) trim | ||
|
@@ -201,6 +212,11 @@ class Subversion(val baseDir: File) extends Vcs { | |
|
||
override def currentBranch: String = workingDirSvnUrl.substring(workingDirSvnUrl.lastIndexOf("/") + 1) | ||
|
||
// FIXME: Need help here | ||
def setBranch(branch: String) = cmd("checkout", branch) | ||
|
||
def newBranch(branch: String) = cmd("checkout", "-b", branch) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is definitely not the right behaviour for svn, I think svn branching requires doing an |
||
override def pushChanges: ProcessBuilder = commit("push changes", false) | ||
|
||
override def isBehindRemote: Boolean = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package object sbtrelease { | ||
type Versions = (String, String) | ||
type Branches = (String, String) | ||
|
||
def versionFormatError = sys.error("Version format is not compatible with " + Version.VersionR.pattern.toString) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target | ||
global/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import ReleaseTransformations._ | ||
import sbt.complete.DefaultParsers._ | ||
|
||
releaseProcess := Seq( | ||
checkSnapshotDependencies, | ||
inquireVersions, | ||
inquireBranches, | ||
setReleaseVersion, | ||
commitReleaseVersion, | ||
setReleaseBranch, | ||
setNextBranch, | ||
setNextVersion, | ||
commitNextVersion | ||
) | ||
|
||
val checkContentsOfVersionSbt = inputKey[Unit]("Check that the contents of version.sbt is as expected") | ||
val parser = Space ~> StringBasic | ||
|
||
checkContentsOfVersionSbt := { | ||
val expected = parser.parsed | ||
val versionFile = ((baseDirectory).value) / "version.sbt" | ||
assert(IO.read(versionFile).contains(expected), s"does not contains ${expected} in ${versionFile}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
val pluginVersion = System.getProperty("plugin.version") | ||
if(pluginVersion == null) | ||
throw new RuntimeException("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
else addSbtPlugin("com.github.gseitz" % "sbt-release" % pluginVersion) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
$ exec git init . | ||
$ exec git add . | ||
$ exec git commit -m init | ||
|
||
> 'release release-version 0.7.0 next-version 1.0.0-SNAPSHOT release-branch release-test next-branch master' | ||
> checkContentsOfVersionSbt 1.0.0-SNAPSHOT | ||
$ exec git checkout release-test | ||
> checkContentsOfVersionSbt 0.7.0 | ||
|
||
-> release with-defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version in ThisBuild := "0.1.0-SNAPSHOT" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been too long since I've used hg to know what the right things are here. I don't think this is right though, I think branches get committed, so you would need to commit after calling the branch command. As with the svn support, happy to merge if these are changed to throw an exception saying this hasn't been implemented for hg yet.