Kiln » gitkiln
Clone URL:  
Pushed to one repository · View In Graph Contained in master

go fmt

Changeset 05535bbaab81

Parent ac2d3e2a6f47

by Profile picture of User 12Benjamin Pollack <benjamin@fogcreek.com>

Changes to 2 files · Browse files at 05535bbaab81 Showing diff from parent ac2d3e2a6f47 Diff from another changeset...

Change 1 of 4 Show Entire File kiln/​kiln.go Stacked
 
72
73
74
75
 
 
 
76
77
78
 
127
128
129
130
 
131
132
133
 
136
137
138
139
 
 
 
140
141
142
143
144
145
146
 
 
 
147
148
149
150
151
152
153
 
 
 
154
155
156
157
158
159
160
 
 
 
161
162
163
 
182
183
184
185
 
 
 
186
187
 
 
 
188
189
190
 
72
73
74
 
75
76
77
78
79
80
 
129
130
131
 
132
133
134
135
 
138
139
140
 
141
142
143
144
145
146
147
148
149
 
150
151
152
153
154
155
156
157
158
 
159
160
161
162
163
164
165
166
167
 
168
169
170
171
172
173
 
192
193
194
 
195
196
197
198
 
199
200
201
202
203
204
@@ -72,7 +72,9 @@
   func (k *KilnClient) DeleteCredentials() (err error) {   creds, err := loadCredentials() - if err != nil { return } + if err != nil { + return + }   if user, ok := creds[k.credentials.User]; ok {   delete(user, k.credentials.KilnUrl)   } @@ -127,7 +129,7 @@
  if strings.HasPrefix(commit, "fatal:") {   err = fmt.Errorf("commit couldn't be resolved (try \"git fetch\")\n")   } else { - browse(k.repoRoute(repo, "History/" + commit)) + browse(k.repoRoute(repo, "History/"+commit))   }   }   return @@ -136,28 +138,36 @@
 // Browse a file in Kiln  func (k *KilnClient) BrowseFile(repo string, file string) error {   path, err := repoRelativePath(file) - if err != nil { return err } + if err != nil { + return err + }   return browse(k.repoRoute(repo, fmt.Sprintf("Files%v", path)))  }    // Browse an annotated file in Kiln  func (k *KilnClient) BrowseAnnotatedFile(repo string, file string) error {   path, err := repoRelativePath(file) - if err != nil { return err } + if err != nil { + return err + }   return browse(k.repoRoute(repo, fmt.Sprintf("Files%v?view=annotate", path)))  }    // Browse a file in Kiln  func (k *KilnClient) BrowseFileHistory(repo string, file string) error {   path, err := repoRelativePath(file) - if err != nil { return err } + if err != nil { + return err + }   return browse(k.repoRoute(repo, fmt.Sprintf("FileHistory%v", path)))  }    // Find the root of the Git repo  func GitRoot() (path string, err error) {   out, err := exec.Command("git", "rev-parse", "--show-toplevel").Output() - if err != nil { return } + if err != nil { + return + }   path = strings.TrimSpace(string(out))   if strings.HasPrefix(path, "fatal:") {   err = fmt.Errorf("unable to find root: %v", path) @@ -182,9 +192,13 @@
 // Change a relative or absolute path into a path relative to the repository root  func repoRelativePath(path string) (string, error) {   root, err := GitRoot() - if err != nil { return "", err } + if err != nil { + return "", err + }   absPath, err := filepath.Abs(path) - if err != nil { return "", err } + if err != nil { + return "", err + }   absPath = filepath.ToSlash(absPath)   return strings.TrimPrefix(absPath, root), nil  }
Change 1 of 2 Show Entire File main.go Stacked
 
54
55
56
57
 
 
 
58
59
60
 
63
64
65
66
 
67
68
69
 
54
55
56
 
57
58
59
60
61
62
 
65
66
67
 
68
69
70
71
@@ -54,7 +54,9 @@
  base, err = url.Parse(s)   if err != nil || (base.Scheme != "http" && base.Scheme != "https") {   out, err := exec.Command("git", "config", "kiln.url").Output() - if err == nil { base, err = url.Parse(strings.TrimSpace(string(out))) } + if err == nil { + base, err = url.Parse(strings.TrimSpace(string(out))) + }   }   if err != nil || (base.Scheme != "http" && base.Scheme != "https") {   err = fmt.Errorf("must either have an HTTP remote or kiln.url specified in config") @@ -63,7 +65,7 @@
    components := strings.Split(base.Path, "/")   l := len(components) - components[l - 1] = strings.TrimSuffix(components[l-1], ".git") + components[l-1] = strings.TrimSuffix(components[l-1], ".git")   path = strings.Join(components[l-3:l], "/")     if strings.HasSuffix(base.Host, ".kilnhg.com") {