gitcycle 0.1.11 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -2
- data/features/gitcycle.feature +7 -4
- data/gitcycle.gemspec +1 -1
- data/lib/gitcycle.rb +29 -16
- metadata +4 -4
data/README.md
CHANGED
@@ -99,8 +99,6 @@ This will add a "pass" label to the issue and will complete the pull request by
|
|
99
99
|
Todo
|
100
100
|
----
|
101
101
|
|
102
|
-
* Check for conflict whenever merge happens
|
103
|
-
* Add conflict check when calling "qa pass [ticket]"
|
104
102
|
* Instead of detecting CONFLICT, use error status $? != 0
|
105
103
|
* Add comment on lighthouse with issue URL
|
106
104
|
* Label issues with ticket milestone?
|
data/features/gitcycle.feature
CHANGED
@@ -34,7 +34,8 @@ Scenario: Feature branch w/ custom branch name
|
|
34
34
|
Adding remote repo 'config.owner/config.repo'.
|
35
35
|
Fetching remote repo 'config.owner/config.repo'.
|
36
36
|
Checking out remote branch 'ticket.id-rename' from 'config.owner/config.repo/master'.
|
37
|
-
|
37
|
+
Pulling 'origin/ticket.id-rename'.
|
38
|
+
Pushing 'origin/ticket.id-rename'.
|
38
39
|
Sending branch information to gitcycle.
|
39
40
|
"""
|
40
41
|
And redis entries valid
|
@@ -55,7 +56,8 @@ Scenario: Feature branch
|
|
55
56
|
Adding remote repo 'config.owner/config.repo'.
|
56
57
|
Fetching remote repo 'config.owner/config.repo'.
|
57
58
|
Checking out remote branch 'ticket.id' from 'config.owner/config.repo/master'.
|
58
|
-
|
59
|
+
Pulling 'origin/ticket.id'.
|
60
|
+
Pushing 'origin/ticket.id'.
|
59
61
|
Sending branch information to gitcycle.
|
60
62
|
"""
|
61
63
|
And redis entries valid
|
@@ -79,7 +81,7 @@ Scenario: Checkout via ticket w/ fresh repo
|
|
79
81
|
And output includes
|
80
82
|
"""
|
81
83
|
Retrieving branch information from gitcycle.
|
82
|
-
Tracking branch 'ticket.id'.
|
84
|
+
Tracking branch 'origin/ticket.id'.
|
83
85
|
"""
|
84
86
|
And current branch is "ticket.id"
|
85
87
|
|
@@ -178,7 +180,8 @@ Scenario: QA issue
|
|
178
180
|
Adding remote repo 'config.owner/config.repo'.
|
179
181
|
Fetching remote repo 'config.owner/config.repo'.
|
180
182
|
Checking out remote branch 'qa_master' from 'config.owner/config.repo/master'.
|
181
|
-
|
183
|
+
Pulling 'origin/qa_master'.
|
184
|
+
Pushing 'origin/qa_master'.
|
182
185
|
Adding remote repo 'config.user/config.repo'.
|
183
186
|
Fetching remote repo 'config.user/config.repo'.
|
184
187
|
Merging remote branch 'ticket.id' from 'config.user/config.repo'.
|
data/gitcycle.gemspec
CHANGED
data/lib/gitcycle.rb
CHANGED
@@ -81,13 +81,7 @@ class Gitcycle
|
|
81
81
|
end
|
82
82
|
|
83
83
|
if branch['exists']
|
84
|
-
|
85
|
-
puts "Checking out branch '#{name}'.\n".green
|
86
|
-
run("git checkout #{name}")
|
87
|
-
else
|
88
|
-
puts "Tracking branch '#{name}'.\n".green
|
89
|
-
run("git fetch && git checkout -b #{name} origin/#{name}")
|
90
|
-
end
|
84
|
+
checkout_or_track(:name => name, :remote => 'origin')
|
91
85
|
else
|
92
86
|
puts "Sending branch information to gitcycle.".green
|
93
87
|
get('branch',
|
@@ -172,10 +166,7 @@ class Gitcycle
|
|
172
166
|
issues = issues[1..-1]
|
173
167
|
|
174
168
|
if pass_fail == 'pass'
|
175
|
-
|
176
|
-
run("git checkout #{qa_branch['source']}")
|
177
|
-
run("git pull origin #{qa_branch['source']}")
|
178
|
-
# TODO: track if source branch doesn't exist
|
169
|
+
checkout_or_track(:name => qa_branch['source'], :remote => 'origin')
|
179
170
|
end
|
180
171
|
|
181
172
|
if issues.empty?
|
@@ -355,7 +346,7 @@ class Gitcycle
|
|
355
346
|
end
|
356
347
|
|
357
348
|
puts "Fetching remote repo '#{owner}/#{repo}'.\n".green
|
358
|
-
run("git fetch #{owner}")
|
349
|
+
run("git fetch -q #{owner}")
|
359
350
|
end
|
360
351
|
|
361
352
|
def branches(options={})
|
@@ -369,6 +360,22 @@ class Gitcycle
|
|
369
360
|
end
|
370
361
|
end
|
371
362
|
|
363
|
+
def checkout_or_track(options={})
|
364
|
+
name = options[:name]
|
365
|
+
remote = options[:remote]
|
366
|
+
|
367
|
+
if branches(:match => name)
|
368
|
+
puts "Checking out branch '#{name}'.\n".green
|
369
|
+
run("git checkout #{name}")
|
370
|
+
else
|
371
|
+
puts "Tracking branch '#{remote}/#{name}'.\n".green
|
372
|
+
run("git fetch -q #{remote}")
|
373
|
+
run("git checkout --track -b #{name} #{remote}/#{name}")
|
374
|
+
end
|
375
|
+
|
376
|
+
run("git pull #{remote} #{name}")
|
377
|
+
end
|
378
|
+
|
372
379
|
def checkout_remote_branch(options={})
|
373
380
|
owner = options[:owner]
|
374
381
|
repo = options[:repo]
|
@@ -376,9 +383,12 @@ class Gitcycle
|
|
376
383
|
target = options[:target] || branch
|
377
384
|
|
378
385
|
if branches(:match => target)
|
379
|
-
|
386
|
+
if yes?("You already have a branch called '#{target}'. Overwrite?")
|
387
|
+
run("git push origin :#{target}")
|
388
|
+
run("branch -D #{target}")
|
389
|
+
else
|
380
390
|
run("git checkout #{target}")
|
381
|
-
run("git pull
|
391
|
+
run("git pull origin #{target}")
|
382
392
|
return
|
383
393
|
end
|
384
394
|
end
|
@@ -386,9 +396,12 @@ class Gitcycle
|
|
386
396
|
add_remote_and_fetch(options)
|
387
397
|
|
388
398
|
puts "Checking out remote branch '#{target}' from '#{owner}/#{repo}/#{branch}'.\n".green
|
389
|
-
run("git checkout -b #{target} #{owner}/#{branch}")
|
399
|
+
run("git checkout --track -b #{target} #{owner}/#{branch}")
|
400
|
+
|
401
|
+
puts "Pulling 'origin/#{target}'.\n".green
|
402
|
+
run("git pull origin #{target}")
|
390
403
|
|
391
|
-
puts "Pushing '
|
404
|
+
puts "Pushing 'origin/#{target}'.\n".green
|
392
405
|
run("git push origin #{target}")
|
393
406
|
end
|
394
407
|
|
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:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 13
|
10
|
+
version: 0.1.13
|
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-01-
|
18
|
+
date: 2012-01-25 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|