gitcycle 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +1 -2
  2. data/gitcycle.gemspec +1 -1
  3. data/lib/gitcycle.rb +48 -17
  4. metadata +4 -4
data/README.md CHANGED
@@ -127,11 +127,10 @@ Todo
127
127
  * Label issues with ticket milestone?
128
128
  * gitc LH-ticket should not created a redis record right away, what happens if someone control-c
129
129
  * gitc -h or gitc help
130
- * gitc discuss should tag issue with 'Discuss'
131
130
  * gitc qa pass # since we're changing this to pass all the tickets, we need to loop through all the merged issues and update the lighthouse state to pending-qa
132
131
  * gitc pull doesnt work in rc: https://gist.github.com/7e508977fbb762d186a6
133
132
  * Tag issue with milestone
134
133
  * There's still a Tagging Issue I tried to fix parseLabel http://d.pr/8eOS , Pass should remove Pending *, but remove the Branch Name
135
- * gitc log, diff, merge, rm, status, reset, mv, commit, diff
134
+ * gitc discuss should tag issue with 'Discuss'
136
135
  * gitc ready - possibly do syntax checks
137
136
  * gitc commands should not track branches, so that they have to use the gitc push vs using git push
data/gitcycle.gemspec CHANGED
@@ -6,7 +6,7 @@ $:.unshift lib unless $:.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "gitcycle"
9
- s.version = '0.2.0'
9
+ s.version = '0.2.1'
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = [ 'Winton Welsh' ]
12
12
  s.email = [ 'mail@wintoni.us' ]
data/lib/gitcycle.rb CHANGED
@@ -37,17 +37,37 @@ class Gitcycle
37
37
  start(args) if args
38
38
  end
39
39
 
40
- def checkout(branch)
40
+ def checkout(remote, branch=nil)
41
41
  require_git && require_config
42
42
 
43
- puts "\nRetrieving repo information from gitcycle.\n".green
44
- repo = get('repo')
43
+ branch, remote = remote, nil if branch.nil?
45
44
 
46
45
  unless branches(:match => branch)
47
- add_remote_and_fetch(:owner => repo['owner'], :repo => repo['name'])
46
+ collab = branch && remote
47
+
48
+ unless collab
49
+ puts "\nRetrieving repo information from gitcycle.\n".green
50
+ repo = get('repo')
51
+ remote = repo['owner']
52
+ end
48
53
 
49
- puts "Creating branch '#{branch}' from '#{repo['owner']}/#{branch}'.\n".green
50
- run("git branch --no-track #{branch} #{repo['owner']}/#{branch}")
54
+ add_remote_and_fetch(
55
+ :owner => remote,
56
+ :repo => @git_repo
57
+ )
58
+
59
+ puts "Creating branch '#{branch}' from '#{remote}/#{branch}'.\n".green
60
+ run("git branch --no-track #{branch} #{remote}/#{branch}")
61
+
62
+ if collab
63
+ puts "Sending branch information to gitcycle.".green
64
+ get('branch',
65
+ 'branch[home]' => remote,
66
+ 'branch[name]' => branch,
67
+ 'branch[collab]' => 1,
68
+ 'create' => 1
69
+ )
70
+ end
51
71
  end
52
72
 
53
73
  puts "Checking out '#{branch}'.\n".green
@@ -165,11 +185,19 @@ class Gitcycle
165
185
  )
166
186
 
167
187
  if branch
168
- merge_remote_branch(
169
- :owner => branch['repo']['owner'],
170
- :repo => branch['repo']['name'],
171
- :branch => branch['source']
172
- )
188
+ if branch['collab']
189
+ merge_remote_branch(
190
+ :owner => branch['home'],
191
+ :repo => branch['repo']['name'],
192
+ :branch => branch['name']
193
+ )
194
+ else
195
+ merge_remote_branch(
196
+ :owner => branch['repo']['owner'],
197
+ :repo => branch['repo']['name'],
198
+ :branch => branch['source']
199
+ )
200
+ end
173
201
  else
174
202
  puts "\nRetrieving repo information from gitcycle.".green
175
203
  repo = get('repo')
@@ -179,13 +207,16 @@ class Gitcycle
179
207
  puts "\nPulling '#{repo['owner']}/#{current_branch}'.\n".green
180
208
  run("git pull #{repo['owner']} #{current_branch}")
181
209
  end
210
+
211
+ branch
182
212
  end
183
213
 
184
214
  def push
185
- branch = branches(:current => true)
215
+ branch = pull
216
+ remote = branch ? branch['home'] : 'origin'
186
217
 
187
- puts "\nPushing branch '#{branch}'.\n".green
188
- run("git push origin #{branch}")
218
+ puts "\nPushing branch '#{remote}/#{branch}'.\n".green
219
+ run("git push #{remote} #{branch}")
189
220
  end
190
221
 
191
222
  def qa(*issues)
@@ -194,7 +225,7 @@ class Gitcycle
194
225
  if issues.empty?
195
226
  puts "\n"
196
227
  get('qa_branch').each do |branches|
197
- puts "qa_#{branches['user']}_#{branches['source']}".green
228
+ puts "qa_#{branches['source']}_#{branches['user']}".green
198
229
  branches['branches'].each do |branch|
199
230
  puts " #{"issue ##{branch['issue']}".yellow}\t#{branch['user']}/#{branch['branch']}"
200
231
  end
@@ -270,7 +301,7 @@ class Gitcycle
270
301
  run("git add . && git add . -u && git commit -a -F .git/MERGE_MSG")
271
302
 
272
303
  puts "Pushing merge resolution of #{conflict['branch']} (issue ##{conflict['issue']}).\n".green
273
- run("git push origin qa_#{qa_branch['user']}_#{qa_branch['source']}")
304
+ run("git push origin qa_#{qa_branch['source']}_#{qa_branch['user']}")
274
305
 
275
306
  puts "\nDe-conflicting on gitcycle.\n".green
276
307
  get('qa_branch',
@@ -506,7 +537,7 @@ class Gitcycle
506
537
  end
507
538
 
508
539
  source = qa_branch['source']
509
- name = "qa_#{qa_branch['user']}_#{source}"
540
+ name = "qa_#{source}_#{qa_branch['user']}"
510
541
 
511
542
  unless qa_branch['branches'].empty?
512
543
  unless options[:preserve]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitcycle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Winton Welsh
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-02 00:00:00 -08:00
18
+ date: 2012-02-03 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency