gitcycle 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +10 -10
- data/features/gitcycle.feature +4 -4
- data/gitcycle.gemspec +1 -1
- data/lib/gitcycle.rb +50 -31
- metadata +4 -4
data/README.md
CHANGED
@@ -94,6 +94,12 @@ This will add a "pass" label to the issue and will complete the pull request by
|
|
94
94
|
More
|
95
95
|
----
|
96
96
|
|
97
|
+
### Checkout Upstream Branch
|
98
|
+
|
99
|
+
If you are working in a fork, it is easy to checkout upstream branches:
|
100
|
+
|
101
|
+
gitc checkout [BRANCH] [...]
|
102
|
+
|
97
103
|
### Reset Branch
|
98
104
|
|
99
105
|
If you associate the wrong branch with a ticket, use `gitc reset` to fix it.
|
@@ -106,20 +112,14 @@ Type `gitc reset` + your ticket URL to reset the branch:
|
|
106
112
|
|
107
113
|
gitc reset https://xxx.lighthouseapp.com/projects/0000/tickets/0000-my-ticket
|
108
114
|
|
109
|
-
### Track Upstream Branch
|
110
|
-
|
111
|
-
If you are working in a fork, it is easy to track upstream branches:
|
112
|
-
|
113
|
-
gitc track [BRANCH] [...]
|
114
|
-
|
115
115
|
Todo
|
116
116
|
----
|
117
117
|
|
118
|
+
* Add ability to associate multiple branches/pull requests with one Lighthouse ticket
|
119
|
+
* Add comment on lighthouse with issue URL
|
120
|
+
* gitc discuss should tag issue with 'Discuss'
|
118
121
|
* On pass or fail, send email to Github email
|
119
122
|
* Note you can use gitc with a string
|
120
123
|
* gitc qa pass, should not set ticket to pending-approval if its already resolved
|
121
124
|
* If gitc reset happens on branch with Github issue, close the existing issue
|
122
|
-
*
|
123
|
-
* Instead of detecting CONFLICT, use error status $? != 0
|
124
|
-
* Label issues with ticket milestone?
|
125
|
-
* gitc LH-ticket should not created a redis record right away, what happens if someone control-c
|
125
|
+
* Tag issue with milestone
|
data/features/gitcycle.feature
CHANGED
@@ -206,16 +206,16 @@ Scenario: QA issue
|
|
206
206
|
And output includes
|
207
207
|
"""
|
208
208
|
Retrieving branch information from gitcycle.
|
209
|
-
Deleting old QA branch '
|
209
|
+
Deleting old QA branch 'qa_config.user_master'.
|
210
210
|
Adding remote repo 'config.owner/config.repo'.
|
211
211
|
Fetching remote 'config.owner'.
|
212
|
-
Checking out remote branch '
|
212
|
+
Checking out remote branch 'qa_config.user_master' from 'config.owner/config.repo/master'.
|
213
213
|
Fetching remote 'origin'.
|
214
|
-
Pushing 'origin/
|
214
|
+
Pushing 'origin/qa_config.user_master'.
|
215
215
|
Adding remote repo 'config.user/config.repo'.
|
216
216
|
Fetching remote 'config.user'.
|
217
217
|
Merging remote branch 'ticket.id' from 'config.user/config.repo'.
|
218
|
-
Pushing branch '
|
218
|
+
Pushing branch 'qa_config.user_master'.
|
219
219
|
Type 'gitc qa pass' to approve all issues in this branch.
|
220
220
|
Type 'gitc qa fail' to reject all issues in this branch.
|
221
221
|
"""
|
data/gitcycle.gemspec
CHANGED
data/lib/gitcycle.rb
CHANGED
@@ -37,6 +37,24 @@ class Gitcycle
|
|
37
37
|
start(args) if args
|
38
38
|
end
|
39
39
|
|
40
|
+
def checkout(branch)
|
41
|
+
require_git && require_config
|
42
|
+
|
43
|
+
puts "\nRetrieving repo information from gitcycle.\n".green
|
44
|
+
repo = get('repo')
|
45
|
+
|
46
|
+
add_remote_and_fetch(:owner => repo['owner'], :repo => repo['name'])
|
47
|
+
|
48
|
+
unless branches(:match => branch)
|
49
|
+
puts "Creating branch '#{branch}' from '#{repo['owner']}/#{branch}'.\n".green
|
50
|
+
run("git branch --no-track #{branch} #{repo['owner']}/#{branch}")
|
51
|
+
end
|
52
|
+
|
53
|
+
puts "Checking out '#{branch}'.\n".green
|
54
|
+
run("git checkout #{branch}")
|
55
|
+
end
|
56
|
+
alias :co :checkout
|
57
|
+
|
40
58
|
def create_branch(url_or_title, reset=false)
|
41
59
|
require_git && require_config
|
42
60
|
|
@@ -59,28 +77,37 @@ class Gitcycle
|
|
59
77
|
|
60
78
|
puts "\nRetrieving branch information from gitcycle.\n".green
|
61
79
|
branch = get('branch', params)
|
62
|
-
|
63
80
|
name = branch['name']
|
64
|
-
owner, repo = branch['repo'].split(':')
|
65
81
|
|
66
|
-
|
67
|
-
branch['
|
68
|
-
branch['source'] = branches(:current => true)
|
82
|
+
begin
|
83
|
+
owner, repo = branch['repo'].split(':')
|
69
84
|
|
70
|
-
unless
|
71
|
-
branch['
|
72
|
-
|
85
|
+
unless branch['exists']
|
86
|
+
branch['home'] = @git_login
|
87
|
+
branch['source'] = branches(:current => true)
|
73
88
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
89
|
+
unless yes?("\nYour work will eventually merge into '#{branch['source']}'. Is this correct?")
|
90
|
+
branch['source'] = q("What branch would you like to eventually merge into?")
|
91
|
+
end
|
92
|
+
|
93
|
+
unless yes?("Would you like to name your branch '#{name}'?")
|
94
|
+
name = q("\nWhat would you like to name your branch?")
|
95
|
+
name = name.gsub(/[\s\W]/, '-')
|
96
|
+
end
|
78
97
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
98
|
+
checkout_remote_branch(
|
99
|
+
:owner => owner,
|
100
|
+
:repo => repo,
|
101
|
+
:branch => branch['source'],
|
102
|
+
:target => name
|
103
|
+
)
|
104
|
+
end
|
105
|
+
rescue SystemExit, Interrupt
|
106
|
+
puts "\nDeleting branch from gitcycle.\n".green
|
107
|
+
branch = get('branch',
|
108
|
+
'branch[name]' => branch['name'],
|
109
|
+
'create' => 0,
|
110
|
+
'reset' => 1
|
84
111
|
)
|
85
112
|
end
|
86
113
|
|
@@ -343,18 +370,6 @@ class Gitcycle
|
|
343
370
|
end
|
344
371
|
end
|
345
372
|
|
346
|
-
def track(*branches)
|
347
|
-
puts "\nRetrieving repo information from gitcycle.\n".green
|
348
|
-
repo = get('repo')
|
349
|
-
|
350
|
-
branches.each do |branch|
|
351
|
-
add_remote_and_fetch(:owner => repo['owner'], :repo => repo['name'])
|
352
|
-
|
353
|
-
puts "Creating branch '#{branch}' from '#{repo['owner']}/#{branch}'.\n".green
|
354
|
-
run("git branch --no-track #{branch} #{repo['owner']}/#{branch}")
|
355
|
-
end
|
356
|
-
end
|
357
|
-
|
358
373
|
private
|
359
374
|
|
360
375
|
def add_remote_and_fetch(options={})
|
@@ -369,7 +384,7 @@ class Gitcycle
|
|
369
384
|
run("git remote rm #{owner}") if remotes(:match => owner)
|
370
385
|
run("git remote add #{owner} git@github.com:#{owner}/#{repo}.git")
|
371
386
|
end
|
372
|
-
|
387
|
+
|
373
388
|
puts "Fetching remote '#{owner}'.\n".green
|
374
389
|
run("git fetch -q #{owner}")
|
375
390
|
end
|
@@ -410,6 +425,7 @@ class Gitcycle
|
|
410
425
|
if branches(:match => target)
|
411
426
|
if yes?("You already have a branch called '#{target}'. Overwrite?")
|
412
427
|
run("git push origin :#{target}")
|
428
|
+
run("git checkout master")
|
413
429
|
run("branch -D #{target}")
|
414
430
|
else
|
415
431
|
run("git checkout #{target}")
|
@@ -481,7 +497,10 @@ class Gitcycle
|
|
481
497
|
unless options[:preserve]
|
482
498
|
if branches(:match => name, :all => true)
|
483
499
|
puts "Deleting old QA branch '#{name}'.\n".green
|
484
|
-
|
500
|
+
if branches(:match => name)
|
501
|
+
run("git checkout master")
|
502
|
+
run("git branch -D #{name}")
|
503
|
+
end
|
485
504
|
run("git push origin :#{name}")
|
486
505
|
end
|
487
506
|
|
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: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 21
|
10
|
+
version: 0.1.21
|
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-
|
18
|
+
date: 2012-02-02 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|