Merge lp:~elopio/snappy-tests-job/get_branch into lp:~fgimenez/snappy-tests-job/trunk

Proposed by Leo Arias
Status: Superseded
Proposed branch: lp:~elopio/snappy-tests-job/get_branch
Merge into: lp:~fgimenez/snappy-tests-job/trunk
Diff against target: 84 lines (+12/-12)
3 files modified
snappy-tests-job/main.go (+1/-1)
source/source.go (+3/-3)
source/source_test.go (+8/-8)
To merge this branch: bzr merge lp:~elopio/snappy-tests-job/get_branch
Reviewer Review Type Date Requested Status
Snappy Developers Pending
Review via email: mp+268687@code.launchpad.net

This proposal supersedes a proposal from 2015-08-21.

This proposal has been superseded by a proposal from 2015-08-21.

Commit message

Renamed Run to Get in the source interface.

Description of the change

I'm adding a Merge func to the interface, and I thought that Run is not as accurate as Get. So I'm renaming it here.

To post a comment you must log in.
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Download full text (4.1 KiB)

On Thu, Aug 20, 2015 at 7:36 PM, Leo Arias <email address hidden> wrote:

> Leo Arias has proposed merging lp:~elopio/snappy-tests-job/get_branch into
> lp:~fgimenez/snappy-tests-job/trunk.
>
> Commit message:
> Renamed Run to Get in the source interface.
>

A rationale here would be good.

>
> Requested reviews:
> Snappy Developers (snappy-dev)
>
> For more details, see:
>
> https://code.launchpad.net/~elopio/snappy-tests-job/get_branch/+merge/268687
>
> I'm adding a Merge func to the interface, and I thought that Run is not as
> accurate as Get. So I'm renaming it here.
> --
> Your team Snappy Developers is requested to review the proposed merge of
> lp:~elopio/snappy-tests-job/get_branch into
> lp:~fgimenez/snappy-tests-job/trunk.
>
> Launchpad-Message-Rationale: Reviewer @snappy-dev
> Launchpad-Notification-Type: code-review
> Launchpad-Branch: ~elopio/snappy-tests-job/get_branch
> Launchpad-Project: snappy-tests-job
>
> === modified file 'snappy-tests-job/main.go'
> --- snappy-tests-job/main.go 2015-08-13 15:56:06 +0000
> +++ snappy-tests-job/main.go 2015-08-21 02:35:42 +0000
> @@ -68,7 +68,7 @@
> // TODO: we need a waitGroup here to run things more efficiently
> utilHandler := utils.NewBasicHandler()
> sourceHandler := source.NewBzrHandler(utilHandler)
> - sourcePath, err := sourceHandler.Run(*src)
> + sourcePath, err := sourceHandler.Get(*src)
> if err != nil {
> log.Panicf("Error getting %s into %s", *src, sourcePath)
> }
>
> === modified file 'source/source.go'
> --- source/source.go 2015-07-24 15:28:01 +0000
> +++ source/source.go 2015-08-21 02:35:42 +0000
> @@ -36,7 +36,7 @@
>
> // Sourcer is the interface satisfied by all the source handlers
> type Sourcer interface {
> - Run(string) (string, error)
> + Get(string) (string, error)
> }
>
> // BzrHandler is a source handler for bazaar
> @@ -44,8 +44,8 @@
> util utils.Utilizer
> }
>
> -// Run is the method for getting the source code
> -func (handler *BzrHandler) Run(repo string) (string, error) {
> +// Get is the method for getting the source code
> +func (handler *BzrHandler) Get(repo string) (string, error) {
> path := filepath.Join(targetPath, strconv.Itoa(os.Getpid()),
> basePkg)
>
> log.Printf("*** Branching %s in %s ***", repo, path)
>
> === modified file 'source/source_test.go'
> --- source/source_test.go 2015-07-24 09:59:38 +0000
> +++ source/source_test.go 2015-08-21 02:35:42 +0000
> @@ -54,8 +54,8 @@
> check.Commentf("Expected type Sourcer, got %T", s.subject))
> }
>
> -func (s *sourceSuite) TestRunCreatesTargetPath(c *check.C) {
> - s.subject.Run(testRepo)
> +func (s *sourceSuite) TestGetCreatesTargetPath(c *check.C) {
> + s.subject.Get(testRepo)
>
> expected := expectedBasePath()
>
> @@ -63,26 +63,26 @@
> check.Commentf("The target directory %s was not created",
> expected))
> }
>
> -func (s *sourceSuite) TestRunCallsBranchCommand(c *check.C) {
> - s.subject.Run(testRepo)
> +func (s *sourceSuite) TestGetCallsBranchCommand(c *check.C) {
> + s.subject.Get(testRepo)
>
> ...

Read more...

Unmerged revisions

62. By Leo Arias

Updated the call to source.Get in main.

61. By Leo Arias

Renamed Run to Get in source.go.

60. By Leo Arias

Renamed Run to Get in the source_tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'snappy-tests-job/main.go'
--- snappy-tests-job/main.go 2015-08-13 15:56:06 +0000
+++ snappy-tests-job/main.go 2015-08-21 02:35:42 +0000
@@ -68,7 +68,7 @@
68 // TODO: we need a waitGroup here to run things more efficiently68 // TODO: we need a waitGroup here to run things more efficiently
69 utilHandler := utils.NewBasicHandler()69 utilHandler := utils.NewBasicHandler()
70 sourceHandler := source.NewBzrHandler(utilHandler)70 sourceHandler := source.NewBzrHandler(utilHandler)
71 sourcePath, err := sourceHandler.Run(*src)71 sourcePath, err := sourceHandler.Get(*src)
72 if err != nil {72 if err != nil {
73 log.Panicf("Error getting %s into %s", *src, sourcePath)73 log.Panicf("Error getting %s into %s", *src, sourcePath)
74 }74 }
7575
=== modified file 'source/source.go'
--- source/source.go 2015-07-24 15:28:01 +0000
+++ source/source.go 2015-08-21 02:35:42 +0000
@@ -36,7 +36,7 @@
3636
37// Sourcer is the interface satisfied by all the source handlers37// Sourcer is the interface satisfied by all the source handlers
38type Sourcer interface {38type Sourcer interface {
39 Run(string) (string, error)39 Get(string) (string, error)
40}40}
4141
42// BzrHandler is a source handler for bazaar42// BzrHandler is a source handler for bazaar
@@ -44,8 +44,8 @@
44 util utils.Utilizer44 util utils.Utilizer
45}45}
4646
47// Run is the method for getting the source code47// Get is the method for getting the source code
48func (handler *BzrHandler) Run(repo string) (string, error) {48func (handler *BzrHandler) Get(repo string) (string, error) {
49 path := filepath.Join(targetPath, strconv.Itoa(os.Getpid()), basePkg)49 path := filepath.Join(targetPath, strconv.Itoa(os.Getpid()), basePkg)
5050
51 log.Printf("*** Branching %s in %s ***", repo, path)51 log.Printf("*** Branching %s in %s ***", repo, path)
5252
=== modified file 'source/source_test.go'
--- source/source_test.go 2015-07-24 09:59:38 +0000
+++ source/source_test.go 2015-08-21 02:35:42 +0000
@@ -54,8 +54,8 @@
54 check.Commentf("Expected type Sourcer, got %T", s.subject))54 check.Commentf("Expected type Sourcer, got %T", s.subject))
55}55}
5656
57func (s *sourceSuite) TestRunCreatesTargetPath(c *check.C) {57func (s *sourceSuite) TestGetCreatesTargetPath(c *check.C) {
58 s.subject.Run(testRepo)58 s.subject.Get(testRepo)
5959
60 expected := expectedBasePath()60 expected := expectedBasePath()
6161
@@ -63,26 +63,26 @@
63 check.Commentf("The target directory %s was not created", expected))63 check.Commentf("The target directory %s was not created", expected))
64}64}
6565
66func (s *sourceSuite) TestRunCallsBranchCommand(c *check.C) {66func (s *sourceSuite) TestGetCallsBranchCommand(c *check.C) {
67 s.subject.Run(testRepo)67 s.subject.Get(testRepo)
6868
69 pullCmd := pullCmd()69 pullCmd := pullCmd()
70 c.Assert(s.fakeUtil.ExecCalls[pullCmd], check.Equals, 1,70 c.Assert(s.fakeUtil.ExecCalls[pullCmd], check.Equals, 1,
71 check.Commentf("The pull command %s was not called", pullCmd))71 check.Commentf("The pull command %s was not called", pullCmd))
72}72}
7373
74func (s *sourceSuite) TestRunReturnValue(c *check.C) {74func (s *sourceSuite) TestGetReturnValue(c *check.C) {
75 path, err := s.subject.Run(testRepo)75 path, err := s.subject.Get(testRepo)
76 expected := expectedReturnPath()76 expected := expectedReturnPath()
7777
78 c.Assert(path, check.Equals, expected, check.Commentf("Unexpected return value path %s", path))78 c.Assert(path, check.Equals, expected, check.Commentf("Unexpected return value path %s", path))
79 c.Assert(err, check.IsNil, check.Commentf("Unexpected return error %s", err))79 c.Assert(err, check.IsNil, check.Commentf("Unexpected return error %s", err))
80}80}
8181
82func (s *sourceSuite) TestRunDoesNotCallBranchCommandOnError(c *check.C) {82func (s *sourceSuite) TestGetDoesNotCallBranchCommandOnError(c *check.C) {
83 s.fakeUtil.FailMkDir = true83 s.fakeUtil.FailMkDir = true
8484
85 s.subject.Run(testRepo)85 s.subject.Get(testRepo)
8686
87 pullCmd := pullCmd()87 pullCmd := pullCmd()
88 c.Assert(s.fakeUtil.ExecCalls[pullCmd], check.Equals, 0,88 c.Assert(s.fakeUtil.ExecCalls[pullCmd], check.Equals, 0,

Subscribers

People subscribed via source and target branches

to all changes: