Merge lp:~axwalk/juju-core/lp1211629-git-config-useremail into lp:~go-bot/juju-core/trunk

Proposed by Andrew Wilkins
Status: Merged
Approved by: Andrew Wilkins
Approved revision: no longer in the source branch.
Merged at revision: 1668
Proposed branch: lp:~axwalk/juju-core/lp1211629-git-config-useremail
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 385 lines (+135/-107)
2 files modified
worker/uniter/charm/git.go (+15/-4)
worker/uniter/charm/git_test.go (+120/-103)
To merge this branch: bzr merge lp:~axwalk/juju-core/lp1211629-git-config-useremail
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+180066@code.launchpad.net

Commit message

worker/uniter/charm: git config user.email on init

If we don't manually set user.email, and git can't
derive an email address from the FQDN (e.g. we don't
have one), then charms cannot be deployed.

Fixes bug #1211629

https://codereview.appspot.com/12924043/

Description of the change

worker/uniter/charm: git config user.email on init

If we don't manually set user.email, and git can't
derive an email address from the FQDN (e.g. we don't
have one), then charms cannot be deployed.

Fixes bug #1211629

https://codereview.appspot.com/12924043/

To post a comment you must log in.
Revision history for this message
Andrew Wilkins (axwalk) wrote :

Reviewers: mp+180066_code.launchpad.net,

Message:
Please take a look.

Description:
worker/uniter/charm: git config user.email on init

If we don't manually set user.email, and git can't
derive an email address from the FQDN (e.g. we don't
have one), then charms cannot be deployed.

Fixes bug #1211629

https://code.launchpad.net/~axwalk/juju-core/lp1211629-git-config-useremail/+merge/180066

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/12924043/

Affected files:
   A [revision details]
   M worker/uniter/charm/git.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20130809021225-6c5p05y8zs5j83o3
+New revision: <email address hidden>

Index: worker/uniter/charm/git.go
=== modified file 'worker/uniter/charm/git.go'
--- worker/uniter/charm/git.go 2013-05-02 15:55:42 +0000
+++ worker/uniter/charm/git.go 2013-08-14 08:46:26 +0000
@@ -54,7 +54,17 @@
   if err := os.MkdirAll(d.path, 0755); err != nil {
    return err
   }
- return d.cmd("init")
+ commands := [][]string{
+ {"init"},
+ {"config", "user.email", "juju@localhost."},
+ {"config", "user.name", "juju"},
+ }
+ for _, args := range commands {
+ if err := d.cmd(args...); err != nil {
+ return err
+ }
+ }
+ return nil
  }

  // AddAll ensures that the next commit will reflect the current contents of

Revision history for this message
Nate Finch (natefinch) wrote :
Revision history for this message
William Reade (fwereade) wrote :

not lgtm without a test, but appears sound otherwise

https://codereview.appspot.com/12924043/

Revision history for this message
Andrew Wilkins (axwalk) wrote :
Revision history for this message
Nate Finch (natefinch) wrote :

not lgtm given that I'm pretty sure it's not going to compile.

https://codereview.appspot.com/12924043/diff/6001/worker/uniter/charm/git_test.go
File worker/uniter/charm/git_test.go (right):

https://codereview.appspot.com/12924043/diff/6001/worker/uniter/charm/git_test.go#newcode17
worker/uniter/charm/git_test.go:17: "regexp"
Does this compile? fmt and regexp aren't used as far as I can tell.

Also, can you sort the imports while you're up there?

https://codereview.appspot.com/12924043/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2013/08/15 13:00:54, nate.finch wrote:
> not lgtm given that I'm pretty sure it's not going to compile.

https://codereview.appspot.com/12924043/diff/6001/worker/uniter/charm/git_test.go
> File worker/uniter/charm/git_test.go (right):

https://codereview.appspot.com/12924043/diff/6001/worker/uniter/charm/git_test.go#newcode17
> worker/uniter/charm/git_test.go:17: "regexp"
> Does this compile? fmt and regexp aren't used as far as I can tell.

Sigh, I need to sleep more. Thanks for the catch... I made a tweak after
running the tests.

> Also, can you sort the imports while you're up there?

Will do.

https://codereview.appspot.com/12924043/

Revision history for this message
Andrew Wilkins (axwalk) wrote :
Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2013/08/15 13:15:02, axw wrote:
> Please take a look.

Before you tell me, I'll move gc to its own line ;)

https://codereview.appspot.com/12924043/

Revision history for this message
Nate Finch (natefinch) wrote :

On 2013/08/15 13:16:09, axw1 wrote:
> On 2013/08/15 13:15:02, axw wrote:
> > Please take a look.

> Before you tell me, I'll move gc to its own line ;)

Awesome, and glad to see more . imports going away. LGTM.

https://codereview.appspot.com/12924043/

Revision history for this message
Tim Penhey (thumper) wrote :

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git.go
File worker/uniter/charm/git.go (right):

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git.go#newcode59
worker/uniter/charm/git.go:59: {"config", "user.email",
"juju@localhost."},
Why does the email address end in a dot?

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go
File worker/uniter/charm/git_test.go (left):

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#oldcode30
worker/uniter/charm/git_test.go:30: s.oldLcAll = os.Getenv("LC_ALL")
I added a testing.PatchEnvironment function that returns a simple
function.

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go
File worker/uniter/charm/git_test.go (right):

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#newcode12
worker/uniter/charm/git_test.go:12: gc "launchpad.net/gocheck"
We've gone for three sections of imports:

std libs

other imports

juju-core

So please add a blank line after gocheck.

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#newcode52
worker/uniter/charm/git_test.go:52: c.Assert(string(out), gc.Matches,
"(.|\n)*user.email=juju@localhost.\nuser.name=juju(.|\n)*")
In testing/checkers there is a Contains matcher.

c.Assert(string(out), jc.Contains, "user.email=juju@localhost.\n")
c.Assert(string(out), jc.Contains, "user.name=juju\n")

Would probably cast out prior though.

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#newcode60
worker/uniter/charm/git_test.go:60: c.Assert(exists, gc.Equals, false)
There is also IsTrue, and IsFalse in testing/checkers

https://codereview.appspot.com/12924043/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2013/08/16 01:10:06, thumper wrote:

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git.go
> File worker/uniter/charm/git.go (right):

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git.go#newcode59
> worker/uniter/charm/git.go:59: {"config", "user.email",
"juju@localhost."},
> Why does the email address end in a dot?

Because I misread the special-use domain RFC. Fixed, though apparently
git doesn't care.

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go
> File worker/uniter/charm/git_test.go (left):

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#oldcode30
> worker/uniter/charm/git_test.go:30: s.oldLcAll = os.Getenv("LC_ALL")
> I added a testing.PatchEnvironment function that returns a simple
function.

Done.

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go
> File worker/uniter/charm/git_test.go (right):

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#newcode12
> worker/uniter/charm/git_test.go:12: gc "launchpad.net/gocheck"
> We've gone for three sections of imports:

> std libs

> other imports

> juju-core

> So please add a blank line after gocheck.

Yep sorry, I just missed that in the last one - done. I'm going to write
a tool to check the import groups, and stick it in a bzr pre-commit
hook.

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#newcode52
> worker/uniter/charm/git_test.go:52: c.Assert(string(out), gc.Matches,
> "(.|\n)*user.email=juju@localhost.\nuser.name=juju(.|\n)*")
> In testing/checkers there is a Contains matcher.

> c.Assert(string(out), jc.Contains, "user.email=juju@localhost.\n")
> c.Assert(string(out), jc.Contains, "user.name=juju\n")

> Would probably cast out prior though.

Done, thanks.

https://codereview.appspot.com/12924043/diff/13001/worker/uniter/charm/git_test.go#newcode60
> worker/uniter/charm/git_test.go:60: c.Assert(exists, gc.Equals, false)
> There is also IsTrue, and IsFalse in testing/checkers

Done.

https://codereview.appspot.com/12924043/

Revision history for this message
Andrew Wilkins (axwalk) wrote :
Revision history for this message
Tim Penhey (thumper) wrote :

LGTM with bonus points for updating the import :)

https://codereview.appspot.com/12924043/diff/22001/worker/uniter/charm/git_test.go
File worker/uniter/charm/git_test.go (left):

https://codereview.appspot.com/12924043/diff/22001/worker/uniter/charm/git_test.go#oldcode11
worker/uniter/charm/git_test.go:11:
"launchpad.net/juju-core/testing/checkers"
We have kind of agreed now to use:

jc "launchpad.net/juju-core/testing/checkers"

This ended up being a three way discussion between Roger, David and me,
and this is the compromise.

https://codereview.appspot.com/12924043/

Revision history for this message
Tim Penhey (thumper) wrote :

On 2013/08/15 09:49:54, fwereade wrote:
> not lgtm without a test, but appears sound otherwise

Formally overriding this "not merge" as it was just about missing tests,
and we have one now.

https://codereview.appspot.com/12924043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'worker/uniter/charm/git.go'
2--- worker/uniter/charm/git.go 2013-05-02 15:55:42 +0000
3+++ worker/uniter/charm/git.go 2013-08-16 03:01:05 +0000
4@@ -8,13 +8,14 @@
5 "fmt"
6 "io"
7 "io/ioutil"
8- "launchpad.net/juju-core/charm"
9- "launchpad.net/juju-core/log"
10- "launchpad.net/juju-core/utils"
11 "os"
12 "os/exec"
13 "path/filepath"
14 "strings"
15+
16+ "launchpad.net/juju-core/charm"
17+ "launchpad.net/juju-core/log"
18+ "launchpad.net/juju-core/utils"
19 )
20
21 var ErrConflict = errors.New("charm upgrade has conflicts")
22@@ -54,7 +55,17 @@
23 if err := os.MkdirAll(d.path, 0755); err != nil {
24 return err
25 }
26- return d.cmd("init")
27+ commands := [][]string{
28+ {"init"},
29+ {"config", "user.email", "juju@localhost"},
30+ {"config", "user.name", "juju"},
31+ }
32+ for _, args := range commands {
33+ if err := d.cmd(args...); err != nil {
34+ return err
35+ }
36+ }
37+ return nil
38 }
39
40 // AddAll ensures that the next commit will reflect the current contents of
41
42=== modified file 'worker/uniter/charm/git_test.go'
43--- worker/uniter/charm/git_test.go 2013-06-25 09:50:52 +0000
44+++ worker/uniter/charm/git_test.go 2013-08-16 03:01:05 +0000
45@@ -5,13 +5,16 @@
46
47 import (
48 "io/ioutil"
49- . "launchpad.net/gocheck"
50+ "os"
51+ "os/exec"
52+ "path/filepath"
53+
54+ gc "launchpad.net/gocheck"
55+
56 corecharm "launchpad.net/juju-core/charm"
57 "launchpad.net/juju-core/testing"
58- "launchpad.net/juju-core/testing/checkers"
59+ jc "launchpad.net/juju-core/testing/checkers"
60 "launchpad.net/juju-core/worker/uniter/charm"
61- "os"
62- "path/filepath"
63 )
64
65 var curl = corecharm.MustParseURL("cs:series/blah-blah-123")
66@@ -19,206 +22,220 @@
67 type GitDirSuite struct {
68 testing.GitSuite
69 LoggingSuite testing.LoggingSuite
70- oldLcAll string
71+ resetLcAll func()
72 }
73
74-var _ = Suite(&GitDirSuite{})
75+var _ = gc.Suite(&GitDirSuite{})
76
77-func (s *GitDirSuite) SetUpTest(c *C) {
78+func (s *GitDirSuite) SetUpTest(c *gc.C) {
79 s.GitSuite.SetUpTest(c)
80 s.LoggingSuite.SetUpTest(c)
81- s.oldLcAll = os.Getenv("LC_ALL")
82- os.Setenv("LC_ALL", "en_US")
83+ s.resetLcAll = testing.PatchEnvironment("LC_ALL", "en_US")
84 }
85
86-func (s *GitDirSuite) TearDownTest(c *C) {
87- os.Setenv("LC_ALL", s.oldLcAll)
88+func (s *GitDirSuite) TearDownTest(c *gc.C) {
89+ s.resetLcAll()
90 s.LoggingSuite.TearDownTest(c)
91 s.GitSuite.TearDownTest(c)
92 }
93
94-func (s *GitDirSuite) TestCreate(c *C) {
95+func (s *GitDirSuite) TestInitConfig(c *gc.C) {
96+ base := c.MkDir()
97+ repo := charm.NewGitDir(filepath.Join(base, "repo"))
98+ err := repo.Init()
99+ c.Assert(err, gc.IsNil)
100+
101+ cmd := exec.Command("git", "config", "--list", "--local")
102+ cmd.Dir = repo.Path()
103+ out, err := cmd.Output()
104+ c.Assert(err, gc.IsNil)
105+ outstr := string(out)
106+ c.Assert(outstr, jc.Contains, "user.email=juju@localhost")
107+ c.Assert(outstr, jc.Contains, "user.name=juju")
108+}
109+
110+func (s *GitDirSuite) TestCreate(c *gc.C) {
111 base := c.MkDir()
112 repo := charm.NewGitDir(filepath.Join(base, "repo"))
113 exists, err := repo.Exists()
114- c.Assert(err, IsNil)
115- c.Assert(exists, Equals, false)
116+ c.Assert(err, gc.IsNil)
117+ c.Assert(exists, jc.IsFalse)
118
119 err = ioutil.WriteFile(repo.Path(), nil, 0644)
120- c.Assert(err, IsNil)
121+ c.Assert(err, gc.IsNil)
122 _, err = repo.Exists()
123- c.Assert(err, ErrorMatches, `".*/repo" is not a directory`)
124+ c.Assert(err, gc.ErrorMatches, `".*/repo" is not a directory`)
125 err = os.Remove(repo.Path())
126- c.Assert(err, IsNil)
127+ c.Assert(err, gc.IsNil)
128
129 err = os.Chmod(base, 0555)
130- c.Assert(err, IsNil)
131+ c.Assert(err, gc.IsNil)
132 defer os.Chmod(base, 0755)
133 err = repo.Init()
134- c.Assert(err, ErrorMatches, ".* permission denied")
135+ c.Assert(err, gc.ErrorMatches, ".* permission denied")
136 exists, err = repo.Exists()
137- c.Assert(err, IsNil)
138- c.Assert(exists, Equals, false)
139+ c.Assert(err, gc.IsNil)
140+ c.Assert(exists, jc.IsFalse)
141
142 err = os.Chmod(base, 0755)
143- c.Assert(err, IsNil)
144+ c.Assert(err, gc.IsNil)
145 err = repo.Init()
146- c.Assert(err, IsNil)
147+ c.Assert(err, gc.IsNil)
148 exists, err = repo.Exists()
149- c.Assert(err, IsNil)
150- c.Assert(exists, Equals, true)
151+ c.Assert(err, gc.IsNil)
152+ c.Assert(exists, jc.IsTrue)
153
154 _, err = charm.ReadCharmURL(repo)
155- c.Assert(err, checkers.Satisfies, os.IsNotExist)
156+ c.Assert(err, jc.Satisfies, os.IsNotExist)
157
158 err = repo.Init()
159- c.Assert(err, IsNil)
160+ c.Assert(err, gc.IsNil)
161 }
162
163-func (s *GitDirSuite) TestAddCommitPullRevert(c *C) {
164+func (s *GitDirSuite) TestAddCommitPullRevert(c *gc.C) {
165 target := charm.NewGitDir(c.MkDir())
166 err := target.Init()
167- c.Assert(err, IsNil)
168+ c.Assert(err, gc.IsNil)
169 err = ioutil.WriteFile(filepath.Join(target.Path(), "initial"), []byte("initial"), 0644)
170- c.Assert(err, IsNil)
171+ c.Assert(err, gc.IsNil)
172 err = charm.WriteCharmURL(target, curl)
173- c.Assert(err, IsNil)
174+ c.Assert(err, gc.IsNil)
175 err = target.AddAll()
176- c.Assert(err, IsNil)
177+ c.Assert(err, gc.IsNil)
178 dirty, err := target.Dirty()
179- c.Assert(err, IsNil)
180- c.Assert(dirty, Equals, true)
181+ c.Assert(err, gc.IsNil)
182+ c.Assert(dirty, jc.IsTrue)
183 err = target.Commitf("initial")
184- c.Assert(err, IsNil)
185+ c.Assert(err, gc.IsNil)
186 dirty, err = target.Dirty()
187- c.Assert(err, IsNil)
188- c.Assert(dirty, Equals, false)
189+ c.Assert(err, gc.IsNil)
190+ c.Assert(dirty, jc.IsFalse)
191
192 source := newRepo(c)
193 err = target.Pull(source)
194- c.Assert(err, IsNil)
195+ c.Assert(err, gc.IsNil)
196 url, err := charm.ReadCharmURL(target)
197- c.Assert(err, IsNil)
198- c.Assert(url, DeepEquals, curl)
199+ c.Assert(err, gc.IsNil)
200+ c.Assert(url, gc.DeepEquals, curl)
201 fi, err := os.Stat(filepath.Join(target.Path(), "some-dir"))
202- c.Assert(err, IsNil)
203- c.Assert(fi, checkers.Satisfies, os.FileInfo.IsDir)
204+ c.Assert(err, gc.IsNil)
205+ c.Assert(fi, jc.Satisfies, os.FileInfo.IsDir)
206 data, err := ioutil.ReadFile(filepath.Join(target.Path(), "some-file"))
207- c.Assert(err, IsNil)
208- c.Assert(string(data), Equals, "hello")
209+ c.Assert(err, gc.IsNil)
210+ c.Assert(string(data), gc.Equals, "hello")
211 dirty, err = target.Dirty()
212- c.Assert(err, IsNil)
213- c.Assert(dirty, Equals, false)
214+ c.Assert(err, gc.IsNil)
215+ c.Assert(dirty, jc.IsFalse)
216
217 err = ioutil.WriteFile(filepath.Join(target.Path(), "another-file"), []byte("blah"), 0644)
218- c.Assert(err, IsNil)
219+ c.Assert(err, gc.IsNil)
220 dirty, err = target.Dirty()
221- c.Assert(err, IsNil)
222- c.Assert(dirty, Equals, true)
223+ c.Assert(err, gc.IsNil)
224+ c.Assert(dirty, jc.IsTrue)
225 err = source.AddAll()
226- c.Assert(err, IsNil)
227+ c.Assert(err, gc.IsNil)
228 dirty, err = target.Dirty()
229- c.Assert(err, IsNil)
230- c.Assert(dirty, Equals, true)
231+ c.Assert(err, gc.IsNil)
232+ c.Assert(dirty, jc.IsTrue)
233
234 err = target.Revert()
235- c.Assert(err, IsNil)
236+ c.Assert(err, gc.IsNil)
237 _, err = os.Stat(filepath.Join(target.Path(), "some-file"))
238- c.Assert(err, checkers.Satisfies, os.IsNotExist)
239+ c.Assert(err, jc.Satisfies, os.IsNotExist)
240 _, err = os.Stat(filepath.Join(target.Path(), "some-dir"))
241- c.Assert(err, checkers.Satisfies, os.IsNotExist)
242+ c.Assert(err, jc.Satisfies, os.IsNotExist)
243 data, err = ioutil.ReadFile(filepath.Join(target.Path(), "initial"))
244- c.Assert(err, IsNil)
245- c.Assert(string(data), Equals, "initial")
246+ c.Assert(err, gc.IsNil)
247+ c.Assert(string(data), gc.Equals, "initial")
248 dirty, err = target.Dirty()
249- c.Assert(err, IsNil)
250- c.Assert(dirty, Equals, false)
251+ c.Assert(err, gc.IsNil)
252+ c.Assert(dirty, jc.IsFalse)
253 }
254
255-func (s *GitDirSuite) TestClone(c *C) {
256+func (s *GitDirSuite) TestClone(c *gc.C) {
257 repo, err := newRepo(c).Clone(c.MkDir())
258- c.Assert(err, IsNil)
259+ c.Assert(err, gc.IsNil)
260 _, err = os.Stat(filepath.Join(repo.Path(), "some-file"))
261- c.Assert(err, checkers.Satisfies, os.IsNotExist)
262+ c.Assert(err, jc.Satisfies, os.IsNotExist)
263 _, err = os.Stat(filepath.Join(repo.Path(), "some-dir"))
264- c.Assert(err, checkers.Satisfies, os.IsNotExist)
265+ c.Assert(err, jc.Satisfies, os.IsNotExist)
266 dirty, err := repo.Dirty()
267- c.Assert(err, IsNil)
268- c.Assert(dirty, Equals, true)
269+ c.Assert(err, gc.IsNil)
270+ c.Assert(dirty, jc.IsTrue)
271
272 err = repo.AddAll()
273- c.Assert(err, IsNil)
274+ c.Assert(err, gc.IsNil)
275 dirty, err = repo.Dirty()
276- c.Assert(err, IsNil)
277- c.Assert(dirty, Equals, true)
278+ c.Assert(err, gc.IsNil)
279+ c.Assert(dirty, jc.IsTrue)
280 err = repo.Commitf("blank overwrite")
281- c.Assert(err, IsNil)
282+ c.Assert(err, gc.IsNil)
283 dirty, err = repo.Dirty()
284- c.Assert(err, IsNil)
285- c.Assert(dirty, Equals, false)
286+ c.Assert(err, gc.IsNil)
287+ c.Assert(dirty, jc.IsFalse)
288
289 lines, err := repo.Log()
290- c.Assert(err, IsNil)
291- c.Assert(lines, HasLen, 2)
292- c.Assert(lines[0], Matches, "[a-f0-9]{7} blank overwrite")
293- c.Assert(lines[1], Matches, "[a-f0-9]{7} im in ur repo committin ur files")
294+ c.Assert(err, gc.IsNil)
295+ c.Assert(lines, gc.HasLen, 2)
296+ c.Assert(lines[0], gc.Matches, "[a-f0-9]{7} blank overwrite")
297+ c.Assert(lines[1], gc.Matches, "[a-f0-9]{7} im in ur repo committin ur files")
298 }
299
300-func (s *GitDirSuite) TestConflictRevert(c *C) {
301+func (s *GitDirSuite) TestConflictRevert(c *gc.C) {
302 source := newRepo(c)
303 updated, err := source.Clone(c.MkDir())
304- c.Assert(err, IsNil)
305+ c.Assert(err, gc.IsNil)
306 err = ioutil.WriteFile(filepath.Join(updated.Path(), "some-dir"), []byte("hello"), 0644)
307- c.Assert(err, IsNil)
308+ c.Assert(err, gc.IsNil)
309 err = updated.Snapshotf("potential conflict src")
310- c.Assert(err, IsNil)
311+ c.Assert(err, gc.IsNil)
312 conflicted, err := updated.Conflicted()
313- c.Assert(err, IsNil)
314- c.Assert(conflicted, Equals, false)
315+ c.Assert(err, gc.IsNil)
316+ c.Assert(conflicted, jc.IsFalse)
317
318 target := charm.NewGitDir(c.MkDir())
319 err = target.Init()
320- c.Assert(err, IsNil)
321+ c.Assert(err, gc.IsNil)
322 err = target.Pull(source)
323- c.Assert(err, IsNil)
324+ c.Assert(err, gc.IsNil)
325 err = ioutil.WriteFile(filepath.Join(target.Path(), "some-dir", "conflicting-file"), []byte("hello"), 0644)
326- c.Assert(err, IsNil)
327+ c.Assert(err, gc.IsNil)
328 err = target.Snapshotf("potential conflict dst")
329- c.Assert(err, IsNil)
330+ c.Assert(err, gc.IsNil)
331 conflicted, err = target.Conflicted()
332- c.Assert(err, IsNil)
333- c.Assert(conflicted, Equals, false)
334+ c.Assert(err, gc.IsNil)
335+ c.Assert(conflicted, jc.IsFalse)
336
337 err = target.Pull(updated)
338- c.Assert(err, Equals, charm.ErrConflict)
339+ c.Assert(err, gc.Equals, charm.ErrConflict)
340 conflicted, err = target.Conflicted()
341- c.Assert(err, IsNil)
342- c.Assert(conflicted, Equals, true)
343+ c.Assert(err, gc.IsNil)
344+ c.Assert(conflicted, jc.IsTrue)
345 dirty, err := target.Dirty()
346- c.Assert(err, IsNil)
347- c.Assert(dirty, Equals, true)
348+ c.Assert(err, gc.IsNil)
349+ c.Assert(dirty, jc.IsTrue)
350
351 err = target.Revert()
352- c.Assert(err, IsNil)
353+ c.Assert(err, gc.IsNil)
354 conflicted, err = target.Conflicted()
355- c.Assert(err, IsNil)
356- c.Assert(conflicted, Equals, false)
357+ c.Assert(err, gc.IsNil)
358+ c.Assert(conflicted, jc.IsFalse)
359 dirty, err = target.Dirty()
360- c.Assert(err, IsNil)
361- c.Assert(dirty, Equals, false)
362+ c.Assert(err, gc.IsNil)
363+ c.Assert(dirty, jc.IsFalse)
364 }
365
366-func newRepo(c *C) *charm.GitDir {
367+func newRepo(c *gc.C) *charm.GitDir {
368 repo := charm.NewGitDir(c.MkDir())
369 err := repo.Init()
370- c.Assert(err, IsNil)
371+ c.Assert(err, gc.IsNil)
372 err = os.Mkdir(filepath.Join(repo.Path(), "some-dir"), 0755)
373- c.Assert(err, IsNil)
374+ c.Assert(err, gc.IsNil)
375 err = ioutil.WriteFile(filepath.Join(repo.Path(), "some-file"), []byte("hello"), 0644)
376- c.Assert(err, IsNil)
377+ c.Assert(err, gc.IsNil)
378 err = repo.AddAll()
379- c.Assert(err, IsNil)
380+ c.Assert(err, gc.IsNil)
381 err = repo.Commitf("im in ur repo committin ur %s", "files")
382- c.Assert(err, IsNil)
383+ c.Assert(err, gc.IsNil)
384 return repo
385 }

Subscribers

People subscribed via source and target branches

to status/vote changes: