Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/savage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala')
-rw-r--r--src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala b/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala
index 7d3c8ec..030736e 100644
--- a/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala
+++ b/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala
@@ -35,13 +35,8 @@ class PullRequestPusher(
}
def push(originRepo: RepositoryId, prNum: PullRequestNumber, commitSha: CommitSha): Boolean = {
- val newBranch = {
- val branchName = s"${settings.BranchPrefix}${prNum.number}-${commitSha.sha}"
- Branch(branchName).getOrElse {
- throw new SecurityException(s"Generated insecure branch name: ${branchName}")
- }
- }
- val branchSpec = s"${commitSha.sha}:${newBranch.asRef}"
+ val newBranch = SavageBranch(prNum, commitSha)
+ val branchSpec = s"${commitSha.sha}:${newBranch.branch.asRef}"
val destRemote = settings.TestRepoId.asPushRemote
val success = SimpleSubprocess(Seq("git", "push", "-f", destRemote, branchSpec)).run() match {
case SuccessfulExit(_) => {
@@ -60,7 +55,7 @@ class PullRequestPusher(
success
}
- private def scheduleFailsafeBranchDeletion(branch: Branch) {
+ private def scheduleFailsafeBranchDeletion(branch: SavageBranch) {
implicit val execContext = context.system.dispatcher
context.system.scheduler.scheduleOnce(settings.TravisTimeout, branchDeleter, branch)
}