Skip to content

Commit

Permalink
close #79 remove remote from upnext
Browse files Browse the repository at this point in the history
  • Loading branch information
groenborg committed Mar 22, 2017
1 parent 75ab7c8 commit 0e8fcbc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
13 changes: 6 additions & 7 deletions ci/notes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Last release brought some unexpected problems with our authentication og permissions to github, whoops.
We have made a fix for theses problems, so just go ahead and get the update and these problems should be a part of the past.
To re-authenticate you need to delete the old 'git phlow' token on github.com and delete your phlow settings in your global .gitconfig file.
We have changed to agent upnext command so automation becomes easier, this is a quickfix and non critical
for users who uses do not use the agent commandset.


#### Patch
- upnext returns a name ready for checkout #79 @groenborg

#### Bug fixes
- phlow can be authenticated on multiple machines #72 @groenborg
- list issues should now work on private repositories #71 @groenborg
- build environment should work on newest go version #73 @groenborg
21 changes: 20 additions & 1 deletion phlow/phlow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,27 @@ func TestUpNext(t *testing.T) {
Convey("Testing output of clean function", func() {
branches := githandler.BranchReady("origin")
res := getNextBranch(branches)
So(res, ShouldEqual, "ready/15-issue-branch")
})

testfixture.RemoveTestRepository(t)

})
}

func TestRemoveRemoteFromName(t *testing.T) {
Convey("Running tests on 'remoteRemoteFromName' function", t, func() {

testfixture.CreateTestRepository(t, false)

Convey("origin should be removed", func() {
branches := githandler.BranchReady("origin")
res := getNextBranch(branches)
res = removeRemoteFromUpNext(res)

t.Log(res)

So(res, ShouldEqual, "origin/ready/15-issue-branch")
So(res, ShouldEqual, "ready/15-issue-branch")
})

testfixture.RemoveTestRepository(t)
Expand Down
16 changes: 15 additions & 1 deletion phlow/upnext.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/praqma/git-phlow/githandler"
"github.com/praqma/git-phlow/options"
"strings"
)

//UpNext ...
Expand Down Expand Up @@ -58,7 +59,20 @@ func getNextBranch(branches []string) string {
sort.Ints(keys)

if len(keys) > 0 {
return m[keys[0]]
res := removeRemoteFromUpNext(m[keys[0]])
return res
}
return ""
}

//remoteRemoteFromUpNext ...
func removeRemoteFromUpNext(name string) string {

remote := githandler.ConfigBranchRemote("master")

if strings.HasPrefix(name, remote+"/") {
name = strings.TrimPrefix(name, remote+"/")
return name
}
return name
}

0 comments on commit 0e8fcbc

Please sign in to comment.