flash_flow 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/flash_flow.yml.erb.example +2 -2
- data/lib/flash_flow/branch_merger.rb +2 -2
- data/lib/flash_flow/data/base.rb +5 -5
- data/lib/flash_flow/data/branch.rb +4 -8
- data/lib/flash_flow/data/collection.rb +31 -39
- data/lib/flash_flow/data/github.rb +1 -2
- data/lib/flash_flow/git.rb +13 -40
- data/lib/flash_flow/merge/acceptance.rb +4 -7
- data/lib/flash_flow/merge/base.rb +0 -6
- data/lib/flash_flow/merge/master.rb +5 -6
- data/lib/flash_flow/merge_order.rb +1 -1
- data/lib/flash_flow/options.rb +1 -1
- data/lib/flash_flow/resolve.rb +1 -1
- data/lib/flash_flow/shadow_repo.rb +2 -2
- data/lib/flash_flow/version.rb +1 -1
- data/test/lib/data/test_branch.rb +5 -17
- data/test/lib/data/test_collection.rb +61 -77
- data/test/lib/data/test_store.rb +6 -10
- data/test/lib/issue_tracker/test_pivotal.rb +5 -5
- data/test/lib/merge/test_acceptance.rb +3 -4
- data/test/lib/test_branch_merger.rb +3 -2
- data/test/lib/test_config.rb +4 -6
- data/test/lib/test_git.rb +2 -2
- data/test/lib/test_merge_order.rb +5 -4
- data/test/lib/test_resolve.rb +2 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82f7cd93c4e7ee082a902f0742453e7e7b187743
|
4
|
+
data.tar.gz: 5e472f2e130e8e7cac9d41b4cedd930eab6a8a9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4fd9f3d07dfb14032ff017c959bcde30d050d5a2910127d03a55869966f251e29ff7f115238ae805a8882450a3dcb1517cfca0aa7a09360985f8ed0f633fb4
|
7
|
+
data.tar.gz: 2b1dfbdeff424442bb95d6538c00e56f681b591711b3e09df034f1260f80bf57943eb77fe2fcec5637902d93865f61eff5d0c3ebb077202174f1cd21208ea28c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -31,12 +31,12 @@ are ready to go for flash_flow basic. If not, edit that file and change branch a
|
|
31
31
|
flash_flow is a ruby script which, in the simplest case, can just be run by calling `flash_flow`.
|
32
32
|
What that will do (once your application is properly configured) is:
|
33
33
|
|
34
|
-
1. Push your branch to the `
|
34
|
+
1. Push your branch to the `remote`
|
35
35
|
2. Reset your `merge_branch` to be the same as your `master_branch`
|
36
36
|
3. Get your list of pull requests from github (or use the saved list, more on that later)
|
37
37
|
4. Filter out any "removed" branches
|
38
38
|
5. Merge the rest into the newly created `merge_branch`
|
39
|
-
6. Push the `merge_branch` to the `
|
39
|
+
6. Push the `merge_branch` to the `remote`
|
40
40
|
7. The `merge_branch` is now a merge of your master branch plus all of your pull requests.
|
41
41
|
|
42
42
|
### Notes
|
data/flash_flow.yml.erb.example
CHANGED
@@ -5,8 +5,8 @@ git:
|
|
5
5
|
# more description elsewhere about how this works.
|
6
6
|
use_rerere: true
|
7
7
|
|
8
|
-
# Which remote
|
9
|
-
|
8
|
+
# Which remote your branches use
|
9
|
+
remote: origin
|
10
10
|
|
11
11
|
# This branch is owned by flash_flow, it force pushes every time. So don't use a branch to which you make
|
12
12
|
# commits. Treat this as 100% ephemeral, but if you can you should deploy it automatically to your
|
@@ -14,7 +14,7 @@ module FlashFlow
|
|
14
14
|
return
|
15
15
|
end
|
16
16
|
|
17
|
-
@git.run("merge --no-ff #{@
|
17
|
+
@git.run("merge --no-ff #{@git.remote}/#{@branch.ref}")
|
18
18
|
|
19
19
|
if @git.last_success? || try_rerere(rerere_forget)
|
20
20
|
@result = :success
|
@@ -41,7 +41,7 @@ module FlashFlow
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def get_sha
|
44
|
-
@git.run("rev-parse #{@
|
44
|
+
@git.run("rev-parse #{@git.remote}/#{@branch.ref}")
|
45
45
|
@git.last_stdout.strip if @git.last_success?
|
46
46
|
end
|
47
47
|
|
data/lib/flash_flow/data/base.rb
CHANGED
@@ -18,14 +18,14 @@ module FlashFlow
|
|
18
18
|
def initialize(branch_config, filename, git, opts={})
|
19
19
|
@git = git
|
20
20
|
@store = Store.new(filename, git, opts)
|
21
|
-
@collection = initialize_collection(branch_config
|
21
|
+
@collection = initialize_collection(branch_config)
|
22
22
|
end
|
23
23
|
|
24
|
-
def initialize_collection(branch_config
|
25
|
-
stored_collection = Collection.from_hash(
|
24
|
+
def initialize_collection(branch_config)
|
25
|
+
stored_collection = Collection.from_hash(stored_branches)
|
26
26
|
|
27
27
|
if ! branch_config.empty?
|
28
|
-
collection = Collection.fetch(
|
28
|
+
collection = Collection.fetch(branch_config)
|
29
29
|
# Order matters. We are marking the PRs as current, not the branches stored in the json
|
30
30
|
collection.mark_all_as_current
|
31
31
|
collection.reverse_merge(stored_collection)
|
@@ -70,7 +70,7 @@ module FlashFlow
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def saved_branches
|
73
|
-
Collection.from_hash(
|
73
|
+
Collection.from_hash(stored_branches).to_a
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -4,12 +4,10 @@ module FlashFlow
|
|
4
4
|
module Data
|
5
5
|
|
6
6
|
class Branch
|
7
|
-
attr_accessor :
|
7
|
+
attr_accessor :ref, :sha, :status, :resolutions, :stories, :conflict_sha, :metadata,
|
8
8
|
:current_record, :merge_order, :updated_at, :created_at
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@remote = _remote
|
12
|
-
@remote_url = _remote_url
|
10
|
+
def initialize(_ref)
|
13
11
|
@ref = _ref
|
14
12
|
@resolutions = {}
|
15
13
|
@stories = []
|
@@ -19,7 +17,7 @@ module FlashFlow
|
|
19
17
|
end
|
20
18
|
|
21
19
|
def self.from_hash(hash)
|
22
|
-
branch = new(hash['
|
20
|
+
branch = new(hash['ref'])
|
23
21
|
branch.sha = hash['sha']
|
24
22
|
branch.status = hash['status']
|
25
23
|
branch.merge_order = hash['merge_order']
|
@@ -44,13 +42,11 @@ module FlashFlow
|
|
44
42
|
end
|
45
43
|
|
46
44
|
def ==(other)
|
47
|
-
other.
|
45
|
+
other.ref == ref
|
48
46
|
end
|
49
47
|
|
50
48
|
def to_hash
|
51
49
|
{
|
52
|
-
'remote' => remote,
|
53
|
-
'remote_url' => remote_url,
|
54
50
|
'ref' => ref,
|
55
51
|
'sha' => sha,
|
56
52
|
'status' => status,
|
@@ -6,10 +6,9 @@ module FlashFlow
|
|
6
6
|
|
7
7
|
class Collection
|
8
8
|
|
9
|
-
attr_accessor :branches
|
9
|
+
attr_accessor :branches
|
10
10
|
|
11
|
-
def initialize(
|
12
|
-
@remotes = remotes
|
11
|
+
def initialize(config=nil)
|
13
12
|
@branches = {}
|
14
13
|
|
15
14
|
if config && config['class'] && config['class']['name']
|
@@ -18,27 +17,34 @@ module FlashFlow
|
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
|
-
def self.fetch(
|
22
|
-
collection = new(
|
20
|
+
def self.fetch(config=nil)
|
21
|
+
collection = new(config)
|
23
22
|
collection.fetch
|
24
23
|
collection
|
25
24
|
end
|
26
25
|
|
27
|
-
def self.from_hash(
|
28
|
-
collection = new
|
29
|
-
collection.branches = branches_from_hash(hash
|
26
|
+
def self.from_hash(hash, collection_instance=nil)
|
27
|
+
collection = new
|
28
|
+
collection.branches = branches_from_hash(hash)
|
30
29
|
collection.instance_variable_set(:@collection_instance, collection_instance)
|
31
30
|
collection
|
32
31
|
end
|
33
32
|
|
34
33
|
def self.branches_from_hash(hash)
|
35
|
-
|
36
|
-
hash
|
34
|
+
{}.tap do |new_branches|
|
35
|
+
hash.each do |_, val|
|
36
|
+
branch = val.is_a?(Branch) ? val : Branch.from_hash(val)
|
37
|
+
new_branches[branch.ref] = branch
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
|
-
def
|
41
|
-
|
42
|
+
def self.key(ref)
|
43
|
+
ref
|
44
|
+
end
|
45
|
+
|
46
|
+
def get(ref)
|
47
|
+
@branches[key(ref)]
|
42
48
|
end
|
43
49
|
|
44
50
|
def to_hash
|
@@ -75,7 +81,7 @@ module FlashFlow
|
|
75
81
|
end
|
76
82
|
end
|
77
83
|
|
78
|
-
self.class.from_hash(
|
84
|
+
self.class.from_hash(merged_branches, @collection_instance)
|
79
85
|
end
|
80
86
|
|
81
87
|
def to_a
|
@@ -120,15 +126,15 @@ module FlashFlow
|
|
120
126
|
end
|
121
127
|
end
|
122
128
|
|
123
|
-
def add_to_merge(
|
124
|
-
branch = record(
|
129
|
+
def add_to_merge(ref)
|
130
|
+
branch = record(ref)
|
125
131
|
branch.current_record = true
|
126
132
|
@collection_instance.add_to_merge(branch) if @collection_instance.respond_to?(:add_to_merge)
|
127
133
|
branch
|
128
134
|
end
|
129
135
|
|
130
|
-
def remove_from_merge(
|
131
|
-
branch = record(
|
136
|
+
def remove_from_merge(ref)
|
137
|
+
branch = record(ref)
|
132
138
|
branch.current_record = true
|
133
139
|
branch.removed!
|
134
140
|
@collection_instance.remove_from_merge(branch) if @collection_instance.respond_to?(:remove_from_merge)
|
@@ -156,8 +162,8 @@ module FlashFlow
|
|
156
162
|
branch
|
157
163
|
end
|
158
164
|
|
159
|
-
def add_story(
|
160
|
-
branch = get(
|
165
|
+
def add_story(ref, story_id)
|
166
|
+
branch = get(ref)
|
161
167
|
branch.stories ||= []
|
162
168
|
branch.stories << story_id
|
163
169
|
|
@@ -186,31 +192,17 @@ module FlashFlow
|
|
186
192
|
|
187
193
|
private
|
188
194
|
|
189
|
-
def key(
|
190
|
-
|
191
|
-
end
|
192
|
-
|
193
|
-
def remote_from_url(url)
|
194
|
-
remotes.detect { |_, url_val| url_val == url }.first
|
195
|
-
end
|
196
|
-
|
197
|
-
def url_from_remote(remote)
|
198
|
-
remotes[remote]
|
199
|
-
end
|
200
|
-
|
201
|
-
def fixup(branch)
|
202
|
-
branch.remote ||= remote_from_url(branch.remote_url)
|
203
|
-
branch.remote_url ||= url_from_remote(branch.remote)
|
195
|
+
def key(ref)
|
196
|
+
self.class.key(ref)
|
204
197
|
end
|
205
198
|
|
206
199
|
def update_or_add(branch)
|
207
|
-
|
208
|
-
|
209
|
-
@branches[key(branch.remote_url, branch.ref)] = old_branch.nil? ? branch : old_branch.merge(branch)
|
200
|
+
old_branch = @branches[key(branch.ref)]
|
201
|
+
@branches[key(branch.ref)] = old_branch.nil? ? branch : old_branch.merge(branch)
|
210
202
|
end
|
211
203
|
|
212
|
-
def record(
|
213
|
-
update_or_add(Branch.new(
|
204
|
+
def record(ref)
|
205
|
+
update_or_add(Branch.new(ref))
|
214
206
|
end
|
215
207
|
|
216
208
|
end
|
@@ -36,7 +36,6 @@ module FlashFlow
|
|
36
36
|
def fetch
|
37
37
|
pull_requests.map do |pr|
|
38
38
|
Branch.from_hash(
|
39
|
-
'remote_url' => pr.head.repo.ssh_url,
|
40
39
|
'ref' => pr.head.ref,
|
41
40
|
'status' => status_from_labels(pr),
|
42
41
|
'metadata' => metadata(pr),
|
@@ -90,7 +89,7 @@ module FlashFlow
|
|
90
89
|
end
|
91
90
|
|
92
91
|
def pr_for(branch)
|
93
|
-
pull_requests.detect { |p| branch.
|
92
|
+
pull_requests.detect { |p| branch.ref == p.head.ref }
|
94
93
|
end
|
95
94
|
|
96
95
|
def update_pr(pr_number)
|
data/lib/flash_flow/git.rb
CHANGED
@@ -3,7 +3,7 @@ require 'shellwords'
|
|
3
3
|
|
4
4
|
module FlashFlow
|
5
5
|
class Git
|
6
|
-
ATTRIBUTES = [:
|
6
|
+
ATTRIBUTES = [:remote, :merge_branch, :master_branch, :release_branch, :use_rerere]
|
7
7
|
attr_reader *ATTRIBUTES
|
8
8
|
attr_reader :working_branch
|
9
9
|
|
@@ -11,7 +11,10 @@ module FlashFlow
|
|
11
11
|
|
12
12
|
def initialize(config, logger=nil)
|
13
13
|
@cmd_runner = CmdRunner.new(logger: logger)
|
14
|
+
|
14
15
|
config['release_branch'] ||= config['master_branch']
|
16
|
+
config['remote'] ||= config['merge_remote'] # For backwards compatibility
|
17
|
+
|
15
18
|
ATTRIBUTES.each do |attr|
|
16
19
|
unless config.has_key?(attr.to_s)
|
17
20
|
raise RuntimeError.new("git configuration missing. Required config parameters: #{ATTRIBUTES}")
|
@@ -55,14 +58,6 @@ module FlashFlow
|
|
55
58
|
run("merge #{branch}")
|
56
59
|
end
|
57
60
|
|
58
|
-
def fetch(remote)
|
59
|
-
@fetched_remotes ||= {}
|
60
|
-
unless @fetched_remotes[remote]
|
61
|
-
run("fetch #{remote}")
|
62
|
-
@fetched_remotes[remote] = true
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
61
|
def branch_contains?(branch, ref)
|
67
62
|
run("branch --contains #{ref}", log: CmdRunner::LOG_CMD)
|
68
63
|
last_stdout.split("\n").detect { |str| str[2..-1] == branch }
|
@@ -73,11 +68,11 @@ module FlashFlow
|
|
73
68
|
end
|
74
69
|
|
75
70
|
def in_original_merge_branch
|
76
|
-
in_branch("#{
|
71
|
+
in_branch("#{remote}/#{merge_branch}") { yield }
|
77
72
|
end
|
78
73
|
|
79
74
|
def read_file_from_merge_branch(filename)
|
80
|
-
run("show #{
|
75
|
+
run("show #{remote}/#{merge_branch}:#{filename}", log: CmdRunner::LOG_CMD)
|
81
76
|
last_stdout
|
82
77
|
end
|
83
78
|
|
@@ -147,28 +142,6 @@ module FlashFlow
|
|
147
142
|
arr.split("\n").map { |s| s.split(".git/rr-cache/").last.split("/postimage").first }
|
148
143
|
end
|
149
144
|
|
150
|
-
def remotes
|
151
|
-
run('remote -v')
|
152
|
-
last_stdout.split("\n")
|
153
|
-
end
|
154
|
-
|
155
|
-
def remotes_hash
|
156
|
-
return @remotes_hash if @remotes_hash
|
157
|
-
|
158
|
-
@remotes_hash = {}
|
159
|
-
remotes.each do |r|
|
160
|
-
name = r.split[0]
|
161
|
-
url = r.split[1]
|
162
|
-
@remotes_hash[name] ||= url
|
163
|
-
end
|
164
|
-
@remotes_hash
|
165
|
-
end
|
166
|
-
|
167
|
-
def fetch_remote_for_url(url)
|
168
|
-
fetch_remotes = remotes.grep(Regexp.new(url)).grep(/ \(fetch\)/)
|
169
|
-
fetch_remotes.map { |remote| remote.to_s.split("\t").first }.first
|
170
|
-
end
|
171
|
-
|
172
145
|
def staged_and_working_dir_files
|
173
146
|
run("status --porcelain")
|
174
147
|
last_stdout.split("\n").reject { |line| line[0..1] == '??' }
|
@@ -190,15 +163,15 @@ module FlashFlow
|
|
190
163
|
|
191
164
|
def reset_temp_merge_branch
|
192
165
|
in_branch(master_branch) do
|
193
|
-
run("fetch #{
|
166
|
+
run("fetch #{remote}")
|
194
167
|
run("branch -D #{temp_merge_branch}")
|
195
168
|
run("checkout -b #{temp_merge_branch}")
|
196
|
-
run("reset --hard #{
|
169
|
+
run("reset --hard #{remote}/#{master_branch}")
|
197
170
|
end
|
198
171
|
end
|
199
172
|
|
200
173
|
def push(branch, force=false)
|
201
|
-
run("push #{'-f' if force} #{
|
174
|
+
run("push #{'-f' if force} #{remote} #{branch}")
|
202
175
|
end
|
203
176
|
|
204
177
|
def copy_temp_to_branch(branch, squash_message = nil)
|
@@ -253,14 +226,14 @@ module FlashFlow
|
|
253
226
|
private
|
254
227
|
|
255
228
|
def squash_commits(branch, commit_message)
|
256
|
-
unless branch_exists?("#{
|
257
|
-
run("push #{
|
229
|
+
unless branch_exists?("#{remote}/#{branch}")
|
230
|
+
run("push #{remote} #{master_branch}:#{branch}")
|
258
231
|
end
|
259
232
|
|
260
233
|
# Get all the files that differ between existing acceptance and new acceptance
|
261
|
-
run("diff --name-only #{
|
234
|
+
run("diff --name-only #{remote}/#{branch} #{branch}")
|
262
235
|
files = last_stdout.split("\n")
|
263
|
-
run("reset #{
|
236
|
+
run("reset #{remote}/#{branch}")
|
264
237
|
|
265
238
|
run("add -f #{files.map { |f| "\"#{Shellwords.escape(f)}\"" }.join(" ")}")
|
266
239
|
|
@@ -25,7 +25,6 @@ module FlashFlow
|
|
25
25
|
open_pull_request
|
26
26
|
|
27
27
|
@lock.with_lock do
|
28
|
-
@git.fetch(@git.merge_remote)
|
29
28
|
@git.in_original_merge_branch do
|
30
29
|
@git.initialize_rerere
|
31
30
|
end
|
@@ -56,7 +55,7 @@ module FlashFlow
|
|
56
55
|
|
57
56
|
def commit_branch_info
|
58
57
|
@stories.each do |story_id|
|
59
|
-
@data.add_story(@git.
|
58
|
+
@data.add_story(@git.remote, @git.working_branch, story_id)
|
60
59
|
end
|
61
60
|
@data.save!
|
62
61
|
end
|
@@ -100,15 +99,13 @@ module FlashFlow
|
|
100
99
|
def open_pull_request
|
101
100
|
return false if [@local_git.master_branch, @local_git.merge_branch].include?(@local_git.working_branch)
|
102
101
|
|
103
|
-
# TODO - This should use the actual remote for the branch we're on
|
104
102
|
@local_git.push(@local_git.working_branch, @force)
|
105
103
|
raise OutOfSyncWithRemote.new("Your branch is out of sync with the remote. If you want to force push, run 'flash_flow -f'") unless @local_git.last_success?
|
106
104
|
|
107
|
-
# TODO - This should use the actual remote for the branch we're on
|
108
105
|
if @do_not_merge
|
109
|
-
@data.remove_from_merge(@local_git.
|
106
|
+
@data.remove_from_merge(@local_git.remote, @local_git.working_branch)
|
110
107
|
else
|
111
|
-
@data.add_to_merge(@local_git.
|
108
|
+
@data.add_to_merge(@local_git.working_branch)
|
112
109
|
end
|
113
110
|
end
|
114
111
|
|
@@ -123,7 +120,7 @@ module FlashFlow
|
|
123
120
|
if branch.ref == @local_git.working_branch
|
124
121
|
branch_not_merged = "ERROR: Your branch did not merge to #{@local_git.merge_branch}. Run 'flash_flow --resolve', fix the merge conflict(s) and then re-run this script\n"
|
125
122
|
else
|
126
|
-
errors << "WARNING: Unable to merge branch #{
|
123
|
+
errors << "WARNING: Unable to merge branch #{@local_git.remote}/#{branch.ref} to #{@local_git.merge_branch} due to conflicts."
|
127
124
|
end
|
128
125
|
end
|
129
126
|
errors << branch_not_merged if branch_not_merged
|
@@ -51,12 +51,6 @@ module FlashFlow
|
|
51
51
|
ordered_branches.each_with_index do |branch, index|
|
52
52
|
branch.merge_order = index + 1
|
53
53
|
|
54
|
-
remote = @git.fetch_remote_for_url(branch.remote_url)
|
55
|
-
if remote.nil?
|
56
|
-
raise RuntimeError.new("No remote found for #{branch.remote_url}. Please run 'git remote add *your_remote_name* #{branch.remote_url}' and try again.")
|
57
|
-
end
|
58
|
-
|
59
|
-
@git.fetch(branch.remote)
|
60
54
|
merger = git_merge(branch)
|
61
55
|
|
62
56
|
yield(branch, merger)
|
@@ -29,12 +29,11 @@ module FlashFlow
|
|
29
29
|
release = @data.releases.detect { |r| r['status'] == 'Pending' }
|
30
30
|
if release
|
31
31
|
raise PendingReleaseError.new("There is already a pending release: #{release}")
|
32
|
-
elsif @git.branch_exists?("#{@git.
|
33
|
-
!@git.branch_contains?(@git.master_branch, @git.get_sha("#{@git.
|
32
|
+
elsif @git.branch_exists?("#{@git.remote}/#{@git.release_branch}") &&
|
33
|
+
!@git.branch_contains?(@git.master_branch, @git.get_sha("#{@git.remote}/#{@git.release_branch}"))
|
34
34
|
raise PendingReleaseError.new("The release branch '#{@git.release_branch}' has commits that are not in master")
|
35
35
|
end
|
36
36
|
|
37
|
-
@git.fetch(@git.merge_remote)
|
38
37
|
@git.in_original_merge_branch do
|
39
38
|
@git.initialize_rerere
|
40
39
|
end
|
@@ -58,10 +57,10 @@ module FlashFlow
|
|
58
57
|
@data.releases.unshift({ created_at: Time.now, sha: release_sha, status: 'Pending' })
|
59
58
|
|
60
59
|
@git.in_temp_merge_branch do
|
61
|
-
@git.run("reset --hard #{@git.
|
60
|
+
@git.run("reset --hard #{@git.remote}/#{@git.merge_branch}")
|
62
61
|
end
|
63
62
|
@git.in_merge_branch do
|
64
|
-
@git.run("reset --hard #{@git.
|
63
|
+
@git.run("reset --hard #{@git.remote}/#{@git.merge_branch}")
|
65
64
|
end
|
66
65
|
|
67
66
|
@data.save!
|
@@ -94,7 +93,7 @@ module FlashFlow
|
|
94
93
|
def parse_branches(user_branches)
|
95
94
|
branch_list = user_branches == ['ready'] ? shippable_branch_names : [user_branches].flatten.compact
|
96
95
|
|
97
|
-
branch_list.map { |b| Data::Branch.new(
|
96
|
+
branch_list.map { |b| Data::Branch.new(b) }
|
98
97
|
end
|
99
98
|
|
100
99
|
def check_branches
|
data/lib/flash_flow/options.rb
CHANGED
@@ -23,7 +23,7 @@ module FlashFlow
|
|
23
23
|
opts.on('--resolve-manual', 'Print instructions to use git to resolve conflicts') { |v| options[:resolve_manual] = true }
|
24
24
|
opts.on('--merge-status', 'Show status of all branches and their stories and exit') { |v| options[:merge_status] = true }
|
25
25
|
opts.on('--merge-status-html', 'Show status of all branches and their stories in html format and exit') { |v| options[:merge_status_html] = true }
|
26
|
-
opts.on('--
|
26
|
+
opts.on('--make-release branch1,branch2', 'Comma-delimited list of branches to merge to the release branch. Run "--merge-release ready" to merge all ready to ship branches') { |v| options[:release_branches] = v.split(',') }
|
27
27
|
|
28
28
|
opts.on_tail("-h", "--help", "Show this message") do
|
29
29
|
puts opts
|
data/lib/flash_flow/resolve.rb
CHANGED
data/lib/flash_flow/version.rb
CHANGED
@@ -73,8 +73,6 @@ module FlashFlow
|
|
73
73
|
def test_from_hash
|
74
74
|
branch = Branch.from_hash(branch_hash)
|
75
75
|
assert_equal(branch.ref, branch_hash['ref'])
|
76
|
-
assert_equal(branch.remote_url, branch_hash['remote_url'])
|
77
|
-
assert_equal(branch.remote, branch_hash['remote'])
|
78
76
|
assert_equal(branch.status, branch_hash['status'])
|
79
77
|
assert_equal(branch.stories, branch_hash['stories'])
|
80
78
|
assert_equal(branch.metadata, branch_hash['metadata'])
|
@@ -126,14 +124,6 @@ module FlashFlow
|
|
126
124
|
branch2 = Branch.from_hash(branch_hash)
|
127
125
|
assert(branch1 == branch2)
|
128
126
|
|
129
|
-
branch1.remote_url = 'different_url'
|
130
|
-
refute(branch1 == branch2)
|
131
|
-
|
132
|
-
branch1.remote_url = branch2.remote_url
|
133
|
-
branch1.remote = 'different remote'
|
134
|
-
refute(branch1 == branch2)
|
135
|
-
|
136
|
-
branch1.remote = branch2.remote
|
137
127
|
branch1.ref = 'different ref'
|
138
128
|
refute(branch1 == branch2)
|
139
129
|
end
|
@@ -144,7 +134,7 @@ module FlashFlow
|
|
144
134
|
end
|
145
135
|
|
146
136
|
def test_success
|
147
|
-
branch = Branch.new(1
|
137
|
+
branch = Branch.new(1)
|
148
138
|
|
149
139
|
branch.success!
|
150
140
|
assert(branch.success?)
|
@@ -154,7 +144,7 @@ module FlashFlow
|
|
154
144
|
end
|
155
145
|
|
156
146
|
def test_fail
|
157
|
-
branch = Branch.new(1
|
147
|
+
branch = Branch.new(1)
|
158
148
|
|
159
149
|
branch.fail!
|
160
150
|
assert(branch.fail?)
|
@@ -164,7 +154,7 @@ module FlashFlow
|
|
164
154
|
end
|
165
155
|
|
166
156
|
def test_removed
|
167
|
-
branch = Branch.new(1
|
157
|
+
branch = Branch.new(1)
|
168
158
|
|
169
159
|
branch.removed!
|
170
160
|
assert(branch.removed?)
|
@@ -174,7 +164,7 @@ module FlashFlow
|
|
174
164
|
end
|
175
165
|
|
176
166
|
def test_deleted
|
177
|
-
branch = Branch.new(1
|
167
|
+
branch = Branch.new(1)
|
178
168
|
|
179
169
|
branch.deleted!
|
180
170
|
assert(branch.deleted?)
|
@@ -184,7 +174,7 @@ module FlashFlow
|
|
184
174
|
end
|
185
175
|
|
186
176
|
def test_unknown
|
187
|
-
branch = Branch.new(1
|
177
|
+
branch = Branch.new(1)
|
188
178
|
|
189
179
|
branch.unknown!
|
190
180
|
assert(branch.unknown?)
|
@@ -198,8 +188,6 @@ module FlashFlow
|
|
198
188
|
def branch_hash
|
199
189
|
@branch_hash ||= {
|
200
190
|
'ref' => 'branch 1',
|
201
|
-
'remote_url' => 'the_origin_url',
|
202
|
-
'remote' => 'origin',
|
203
191
|
'sha' => 'random_sha',
|
204
192
|
'status' => 'success',
|
205
193
|
'merge_order' => nil,
|
@@ -18,18 +18,13 @@ module FlashFlow
|
|
18
18
|
def setup
|
19
19
|
setup_fake_branches
|
20
20
|
@fake_branches = FakeBranches.branches
|
21
|
-
@branch = Branch.new('
|
22
|
-
@collection = Collection.new({ '
|
21
|
+
@branch = Branch.new('some_branch')
|
22
|
+
@collection = Collection.new({ 'class' => { 'name' => 'FakeBranches' }})
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_from_hash_set_branches
|
26
|
-
hash = { '
|
27
|
-
assert_equal(Collection.from_hash(
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_from_hash_set_remotes
|
31
|
-
remotes = { 'some_remote' => 'some_remote_url' }
|
32
|
-
assert_equal(Collection.from_hash(remotes, {}).remotes, remotes)
|
26
|
+
hash = { 'some_branch' => Branch.new('some_branch') }
|
27
|
+
assert_equal(Collection.from_hash(hash).branches, hash)
|
33
28
|
end
|
34
29
|
|
35
30
|
def test_fetch_calls_collection_class
|
@@ -44,17 +39,8 @@ module FlashFlow
|
|
44
39
|
end
|
45
40
|
|
46
41
|
def test_fetch_maps_collection_class_to_branches
|
47
|
-
branch = Data::Branch.new('
|
48
|
-
@fake_branches.expect(:fetch, [Branch.from_hash({'
|
49
|
-
@collection.fetch
|
50
|
-
|
51
|
-
assert_equal(@collection.branches.values, [branch])
|
52
|
-
@fake_branches.verify
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_fetch_finds_the_remote
|
56
|
-
branch = Data::Branch.new('origin', 'the_origin_url', 'some_branch')
|
57
|
-
@fake_branches.expect(:fetch, [Branch.from_hash({'remote_url' => branch.remote_url, 'ref' => branch.ref })], [])
|
42
|
+
branch = Data::Branch.new('some_branch')
|
43
|
+
@fake_branches.expect(:fetch, [Branch.from_hash({'ref' => branch.ref })], [])
|
58
44
|
@collection.fetch
|
59
45
|
|
60
46
|
assert_equal(@collection.branches.values, [branch])
|
@@ -64,99 +50,97 @@ module FlashFlow
|
|
64
50
|
def test_reverse_merge_when_old_is_empty
|
65
51
|
@collection.mark_success(@branch)
|
66
52
|
|
67
|
-
merged = @collection.reverse_merge(Collection.from_hash({}
|
68
|
-
assert_equal(['
|
69
|
-
assert(merged.get('
|
53
|
+
merged = @collection.reverse_merge(Collection.from_hash({}))
|
54
|
+
assert_equal(['some_branch'], merged.to_h.keys)
|
55
|
+
assert(merged.get('some_branch').success?)
|
70
56
|
end
|
71
57
|
|
72
58
|
def test_reverse_merge_old_marks_old_branches
|
73
59
|
@collection.mark_success(@branch)
|
74
60
|
|
75
|
-
merged = @collection.reverse_merge(Collection.from_hash(
|
76
|
-
assert(merged.get('
|
61
|
+
merged = @collection.reverse_merge(Collection.from_hash(old_branches))
|
62
|
+
assert(merged.get('some_old_branch').unknown?)
|
77
63
|
end
|
78
64
|
|
79
65
|
def test_reverse_merge_old_adds_new_stories
|
80
66
|
@collection.mark_success(@branch)
|
81
|
-
@collection.add_story('
|
82
|
-
merged = @collection.reverse_merge(Collection.from_hash(
|
67
|
+
@collection.add_story('some_branch', '456')
|
68
|
+
merged = @collection.reverse_merge(Collection.from_hash(old_branches))
|
83
69
|
|
84
|
-
assert_equal(['222', '456'], merged.get('
|
70
|
+
assert_equal(['222', '456'], merged.get('some_branch').stories)
|
85
71
|
end
|
86
72
|
|
87
73
|
def test_reverse_merge_old_uses_old_created_at
|
88
|
-
@collection.add_to_merge('
|
89
|
-
@collection.add_to_merge('
|
90
|
-
old_branch_collection = Collection.from_hash(
|
74
|
+
@collection.add_to_merge('some_old_branch')
|
75
|
+
@collection.add_to_merge('some_new_branch')
|
76
|
+
old_branch_collection = Collection.from_hash(old_branches)
|
91
77
|
merged = @collection.reverse_merge(old_branch_collection)
|
92
78
|
|
93
|
-
assert_equal(old_branch_collection.get('
|
79
|
+
assert_equal(old_branch_collection.get('some_branch').created_at, merged.get('some_branch').created_at)
|
94
80
|
# Assert the new branch is created_at within the last minute
|
95
|
-
assert(merged.get('
|
81
|
+
assert(merged.get('some_new_branch').created_at > (Time.now - 60))
|
96
82
|
end
|
97
83
|
|
98
84
|
def test_reverse_merge_old_uses_new_status
|
99
|
-
@collection.mark_failure(old_branches['
|
100
|
-
merged = @collection.reverse_merge(Collection.from_hash(
|
85
|
+
@collection.mark_failure(old_branches['some_branch'])
|
86
|
+
merged = @collection.reverse_merge(Collection.from_hash(old_branches))
|
101
87
|
|
102
|
-
assert(merged.get('
|
88
|
+
assert(merged.get('some_branch').fail?)
|
103
89
|
end
|
104
90
|
|
105
91
|
def test_fetch_returns_a_collection_instance
|
106
92
|
FakeBranches.branches.expect(:fetch, [])
|
107
|
-
collection = Collection.fetch({ '
|
93
|
+
collection = Collection.fetch({ 'class' => { 'name' => 'FakeBranches' }})
|
108
94
|
assert(collection.is_a?(Collection))
|
109
95
|
end
|
110
96
|
|
111
97
|
def test_add_to_merge_new_branch
|
112
|
-
@collection.add_to_merge('
|
113
|
-
assert_equal(@collection.get('
|
114
|
-
assert_equal(@collection.get('the_origin_url', 'some_branch').remote, 'origin')
|
115
|
-
assert_equal(@collection.get('the_origin_url', 'some_branch').remote_url, 'the_origin_url')
|
98
|
+
@collection.add_to_merge('some_branch')
|
99
|
+
assert_equal(@collection.get('some_branch').ref, 'some_branch')
|
116
100
|
end
|
117
101
|
|
118
102
|
def test_add_to_merge_existing_branch
|
119
103
|
@collection.mark_failure(@branch)
|
120
|
-
@collection.add_to_merge(@branch.
|
104
|
+
@collection.add_to_merge(@branch.ref)
|
121
105
|
|
122
|
-
assert_equal(@collection.get(@branch.
|
106
|
+
assert_equal(@collection.get(@branch.ref), @branch)
|
123
107
|
end
|
124
108
|
|
125
109
|
def test_add_to_merge_calls_branches_class
|
126
110
|
@fake_branches.expect(:add_to_merge, true, [@branch])
|
127
|
-
@collection.add_to_merge(@branch.
|
111
|
+
@collection.add_to_merge(@branch.ref)
|
128
112
|
|
129
113
|
@fake_branches.verify
|
130
114
|
end
|
131
115
|
|
132
116
|
def test_remove_from_merge_new_branch
|
133
|
-
@collection.remove_from_merge(@branch.
|
134
|
-
assert(@collection.get(@branch.
|
117
|
+
@collection.remove_from_merge(@branch.ref)
|
118
|
+
assert(@collection.get(@branch.ref).removed?)
|
135
119
|
end
|
136
120
|
|
137
121
|
def test_remove_from_merge_existing_branch
|
138
122
|
@collection.mark_success(@branch)
|
139
|
-
assert(@collection.get(@branch.
|
140
|
-
@collection.remove_from_merge(@branch.
|
141
|
-
assert(@collection.get(@branch.
|
123
|
+
assert(@collection.get(@branch.ref).success?)
|
124
|
+
@collection.remove_from_merge(@branch.ref)
|
125
|
+
assert(@collection.get(@branch.ref).removed?)
|
142
126
|
end
|
143
127
|
|
144
128
|
def test_remove_from_merge_calls_branches_class
|
145
129
|
@fake_branches.expect(:remove_from_merge, true, [@branch])
|
146
|
-
@collection.remove_from_merge(@branch.
|
130
|
+
@collection.remove_from_merge(@branch.ref)
|
147
131
|
@fake_branches.verify
|
148
132
|
end
|
149
133
|
|
150
134
|
def test_mark_success_new_branch
|
151
135
|
@collection.mark_success(@branch)
|
152
|
-
assert(@collection.get(@branch.
|
136
|
+
assert(@collection.get(@branch.ref).success?)
|
153
137
|
end
|
154
138
|
|
155
139
|
def test_mark_success_existing_branch
|
156
|
-
branch = @collection.add_to_merge(@branch.
|
140
|
+
branch = @collection.add_to_merge(@branch.ref)
|
157
141
|
@collection.mark_failure(branch)
|
158
142
|
@collection.mark_success(branch)
|
159
|
-
assert(@collection.get(@branch.
|
143
|
+
assert(@collection.get(@branch.ref).success?)
|
160
144
|
end
|
161
145
|
|
162
146
|
def test_mark_success_calls_branches_class
|
@@ -166,10 +150,10 @@ module FlashFlow
|
|
166
150
|
end
|
167
151
|
|
168
152
|
def test_mark_failure_existing_branch
|
169
|
-
branch = @collection.add_to_merge(@branch.
|
153
|
+
branch = @collection.add_to_merge(@branch.ref)
|
170
154
|
@collection.mark_success(branch)
|
171
155
|
@collection.mark_failure(branch)
|
172
|
-
assert(@collection.get(@branch.
|
156
|
+
assert(@collection.get(@branch.ref).fail?)
|
173
157
|
end
|
174
158
|
|
175
159
|
def test_mark_failure_new_branch
|
@@ -185,14 +169,14 @@ module FlashFlow
|
|
185
169
|
|
186
170
|
def test_mark_deleted_new_branch
|
187
171
|
@collection.mark_deleted(@branch)
|
188
|
-
assert(@collection.get(@branch.
|
172
|
+
assert(@collection.get(@branch.ref).deleted?)
|
189
173
|
end
|
190
174
|
|
191
175
|
def test_mark_deleted_existing_branch
|
192
|
-
branch = @collection.add_to_merge(@branch.
|
176
|
+
branch = @collection.add_to_merge(@branch.ref)
|
193
177
|
@collection.mark_failure(branch)
|
194
178
|
@collection.mark_deleted(branch)
|
195
|
-
assert(@collection.get(@branch.
|
179
|
+
assert(@collection.get(@branch.ref).deleted?)
|
196
180
|
end
|
197
181
|
|
198
182
|
def test_mark_deleted_calls_branches_class
|
@@ -202,15 +186,15 @@ module FlashFlow
|
|
202
186
|
end
|
203
187
|
|
204
188
|
def test_add_story
|
205
|
-
@collection.add_to_merge('
|
206
|
-
@collection.add_story('
|
207
|
-
assert_equal(@collection.get('
|
189
|
+
@collection.add_to_merge('some_branch')
|
190
|
+
@collection.add_story('some_branch', '999')
|
191
|
+
assert_equal(@collection.get('some_branch').stories, ['999'])
|
208
192
|
end
|
209
193
|
|
210
194
|
def test_add_story_calls_branches_class
|
211
195
|
@fake_branches.expect(:add_story, true, [@branch, '999'])
|
212
|
-
@collection.add_to_merge('
|
213
|
-
@collection.add_story('
|
196
|
+
@collection.add_to_merge('some_branch')
|
197
|
+
@collection.add_story('some_branch', '999')
|
214
198
|
@fake_branches.verify
|
215
199
|
end
|
216
200
|
|
@@ -237,9 +221,9 @@ module FlashFlow
|
|
237
221
|
end
|
238
222
|
|
239
223
|
def test_current_branches
|
240
|
-
branch1 = Branch.new('111'
|
241
|
-
branch2 = Branch.new('222'
|
242
|
-
branch3 = Branch.new('333'
|
224
|
+
branch1 = Branch.new('111')
|
225
|
+
branch2 = Branch.new('222')
|
226
|
+
branch3 = Branch.new('333')
|
243
227
|
branch2.current_record = true
|
244
228
|
@collection.mark_success(branch1)
|
245
229
|
@collection.mark_success(branch2)
|
@@ -249,9 +233,9 @@ module FlashFlow
|
|
249
233
|
end
|
250
234
|
|
251
235
|
def test_mark_all_as_current
|
252
|
-
branch1 = Branch.new('111'
|
253
|
-
branch2 = Branch.new('222'
|
254
|
-
branch3 = Branch.new('333'
|
236
|
+
branch1 = Branch.new('111')
|
237
|
+
branch2 = Branch.new('222')
|
238
|
+
branch3 = Branch.new('333')
|
255
239
|
branch2.current_record = true
|
256
240
|
@collection.mark_success(branch1)
|
257
241
|
@collection.mark_success(branch2)
|
@@ -288,35 +272,35 @@ module FlashFlow
|
|
288
272
|
@collection.mark_failure(fail1)
|
289
273
|
@collection.mark_success(success1)
|
290
274
|
@collection.mark_failure(fail2)
|
291
|
-
@removed1 = @collection.remove_from_merge(removed1.
|
275
|
+
@removed1 = @collection.remove_from_merge(removed1.ref)
|
292
276
|
@collection.mark_success(success2)
|
293
277
|
@collection.mark_all_as_current
|
294
278
|
end
|
295
279
|
|
296
280
|
def fail1
|
297
|
-
@fail1 ||= Branch.new('111'
|
281
|
+
@fail1 ||= Branch.new('111')
|
298
282
|
end
|
299
283
|
|
300
284
|
def fail2
|
301
|
-
@fail2 ||= Branch.new('333'
|
285
|
+
@fail2 ||= Branch.new('333')
|
302
286
|
end
|
303
287
|
|
304
288
|
def success1
|
305
|
-
@success1 ||= Branch.new('222'
|
289
|
+
@success1 ||= Branch.new('222')
|
306
290
|
end
|
307
291
|
|
308
292
|
def success2
|
309
|
-
@success2 ||= Branch.new('555'
|
293
|
+
@success2 ||= Branch.new('555')
|
310
294
|
end
|
311
295
|
|
312
296
|
def removed1
|
313
|
-
@removed1 ||= Branch.new('444'
|
297
|
+
@removed1 ||= Branch.new('444')
|
314
298
|
end
|
315
299
|
|
316
300
|
def old_branches
|
317
301
|
@old_branches ||= {
|
318
|
-
'
|
319
|
-
'
|
302
|
+
'some_old_branch' => Branch.from_hash({'ref' => 'some_old_branch', 'created_at' => (Time.now - 3600), 'stories' => ['111']}),
|
303
|
+
'some_branch' => Branch.from_hash({'ref' => 'some_branch', 'status' => 'success', 'created_at' => (Time.now - 1800), 'stories' => ['222']})
|
320
304
|
}
|
321
305
|
end
|
322
306
|
end
|
data/test/lib/data/test_store.rb
CHANGED
@@ -6,8 +6,8 @@ module FlashFlow
|
|
6
6
|
class TestStore < Minitest::Test
|
7
7
|
def setup
|
8
8
|
@mock_git = MockGit.new
|
9
|
-
@collection = Collection.new
|
10
|
-
@branch = Branch.new('
|
9
|
+
@collection = Collection.new
|
10
|
+
@branch = Branch.new('some_branch')
|
11
11
|
@storage = Store.new('/dev/null', @mock_git)
|
12
12
|
end
|
13
13
|
|
@@ -30,8 +30,8 @@ module FlashFlow
|
|
30
30
|
@old_branches ||= {
|
31
31
|
'version' => '1.0.0',
|
32
32
|
'branches' => {
|
33
|
-
'
|
34
|
-
'
|
33
|
+
'some_old_branch' => {'ref' => 'some_old_branch', 'created_at' => (Time.now - 3600).to_s, 'stories' => ['111']},
|
34
|
+
'some_branch' => {'ref' => 'some_branch', 'status' => 'success', 'created_at' => (Time.now - 1800).to_s, 'stories' => ['222']}
|
35
35
|
}
|
36
36
|
}
|
37
37
|
end
|
@@ -39,19 +39,15 @@ module FlashFlow
|
|
39
39
|
def sorted_branches
|
40
40
|
@sorted_branches ||= {
|
41
41
|
'branches' => {
|
42
|
-
'
|
42
|
+
'some_branch' => {
|
43
43
|
'created_at' => (Time.now - 1800).to_s,
|
44
44
|
'ref' => 'some_branch',
|
45
|
-
'remote' => 'origin',
|
46
|
-
'remote_url' => 'the_origin_url',
|
47
45
|
'status' => 'success',
|
48
46
|
'stories' => ['222']
|
49
47
|
},
|
50
|
-
'
|
48
|
+
'some_old_branch' => {
|
51
49
|
'created_at' => (Time.now - 3600).to_s,
|
52
50
|
'ref' => 'some_old_branch',
|
53
|
-
'remote' => 'origin',
|
54
|
-
'remote_url' => 'the_origin_url',
|
55
51
|
'stories' => ['111']},
|
56
52
|
},
|
57
53
|
'version' => '1.0.0',
|
@@ -285,11 +285,11 @@ module FlashFlow
|
|
285
285
|
end
|
286
286
|
|
287
287
|
def sample_branches
|
288
|
-
@sample_branches ||= [Data::Branch.from_hash({'ref' => 'branch1', '
|
289
|
-
Data::Branch.from_hash({'ref' => 'branch2', '
|
290
|
-
Data::Branch.from_hash({'ref' => 'branch3', '
|
291
|
-
Data::Branch.from_hash({'ref' => 'branch4', '
|
292
|
-
Data::Branch.from_hash({'ref' => 'branch5', '
|
288
|
+
@sample_branches ||= [Data::Branch.from_hash({'ref' => 'branch1', 'sha' => 'sha1', 'status' => 'success', 'created_at' => (Time.now - 3600), 'stories' => ['111']}),
|
289
|
+
Data::Branch.from_hash({'ref' => 'branch2', 'sha' => 'sha2', 'status' => 'success', 'created_at' => (Time.now - 1800), 'stories' => ['222']}),
|
290
|
+
Data::Branch.from_hash({'ref' => 'branch3', 'sha' => 'sha3', 'status' => 'fail', 'created_at' => (Time.now - 1800), 'stories' => ['333']}),
|
291
|
+
Data::Branch.from_hash({'ref' => 'branch4', 'sha' => 'sha4', 'status' => nil, 'created_at' => (Time.now - 1800), 'stories' => ['444']}),
|
292
|
+
Data::Branch.from_hash({'ref' => 'branch5', 'sha' => 'sha5', 'status' => 'removed', 'created_at' => (Time.now - 1800), 'stories' => ['555']})
|
293
293
|
]
|
294
294
|
end
|
295
295
|
end
|
@@ -10,15 +10,14 @@ module FlashFlow
|
|
10
10
|
config!(git:
|
11
11
|
{
|
12
12
|
'merge_branch' => 'test_acceptance',
|
13
|
-
'
|
13
|
+
'remote' => 'test_remote',
|
14
14
|
'master_branch' => 'test_master',
|
15
|
-
'remotes' => ['fake_origin'],
|
16
15
|
'use_rerere' => true
|
17
16
|
},
|
18
17
|
branches: {}
|
19
18
|
)
|
20
19
|
|
21
|
-
@branch = Data::Branch.from_hash({'ref' => 'pushing_branch', '
|
20
|
+
@branch = Data::Branch.from_hash({'ref' => 'pushing_branch', 'status' => 'fail', 'stories' => []})
|
22
21
|
@deploy = Acceptance.new
|
23
22
|
end
|
24
23
|
|
@@ -71,7 +70,7 @@ module FlashFlow
|
|
71
70
|
def test_print_errors_when_another_branch_cant_merge
|
72
71
|
data.expect(:failures, [@branch])
|
73
72
|
|
74
|
-
other_branch_error = "WARNING: Unable to merge branch
|
73
|
+
other_branch_error = "WARNING: Unable to merge branch test_remote/pushing_branch to test_acceptance due to conflicts."
|
75
74
|
|
76
75
|
assert_equal(@deploy.format_errors, other_branch_error)
|
77
76
|
end
|
@@ -63,14 +63,15 @@ module FlashFlow
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def branch
|
66
|
-
@branch ||= Data::Branch.from_hash({'ref' => 'pushing_branch', '
|
66
|
+
@branch ||= Data::Branch.from_hash({'ref' => 'pushing_branch', 'status' => 'fail', 'stories' => []})
|
67
67
|
end
|
68
68
|
|
69
69
|
def git
|
70
70
|
return @git if @git
|
71
71
|
|
72
72
|
@git = Minitest::Mock.new
|
73
|
-
@git.expect(:
|
73
|
+
@git.expect(:remote, 'origin', [])
|
74
|
+
@git.expect(:run, true, ["merge --no-ff origin/#{branch.ref}"])
|
74
75
|
end
|
75
76
|
|
76
77
|
end
|
data/test/lib/test_config.rb
CHANGED
@@ -6,10 +6,9 @@ module FlashFlow
|
|
6
6
|
@config_hash = {
|
7
7
|
'git' => {
|
8
8
|
'use_rerere' => true,
|
9
|
-
'
|
9
|
+
'remote' => 'arbitrary_remote',
|
10
10
|
'merge_branch' => 'acceptance',
|
11
|
-
'master_branch' => 'master'
|
12
|
-
'remotes' => ['origin']
|
11
|
+
'master_branch' => 'master'
|
13
12
|
},
|
14
13
|
'branch_info_file' => 'some_file.txt',
|
15
14
|
'notifier' => {
|
@@ -43,10 +42,9 @@ module FlashFlow
|
|
43
42
|
assert('some_file.txt' == config.branch_info_file)
|
44
43
|
assert({
|
45
44
|
'use_rerere' => true,
|
46
|
-
'
|
45
|
+
'remote' => 'arbitrary_remote',
|
47
46
|
'merge_branch' => 'acceptance',
|
48
|
-
'master_branch' => 'master'
|
49
|
-
'remotes' => ['origin']
|
47
|
+
'master_branch' => 'master'
|
50
48
|
} == config.git)
|
51
49
|
assert({ 'class' => { 'name' => 'NotifierClass' }} == config.notifier)
|
52
50
|
assert({ 'class' => { 'name' => 'IssueTrackerClass' }} == config.issue_tracker)
|
data/test/lib/test_git.rb
CHANGED
@@ -5,9 +5,8 @@ module FlashFlow
|
|
5
5
|
def setup
|
6
6
|
@git_args = {
|
7
7
|
'merge_branch' => 'acceptance',
|
8
|
-
'
|
8
|
+
'remote' => 'origin',
|
9
9
|
'master_branch' => 'master',
|
10
|
-
'remotes' => ['origin'],
|
11
10
|
'use_rerere' => true
|
12
11
|
}
|
13
12
|
@cmd_runner = setup_cmd_runner
|
@@ -15,6 +14,7 @@ module FlashFlow
|
|
15
14
|
|
16
15
|
def test_initialize_rerere_checks_flag
|
17
16
|
@git_args['use_rerere'] = false
|
17
|
+
|
18
18
|
instance.initialize_rerere
|
19
19
|
|
20
20
|
@cmd_runner.verify
|
@@ -46,7 +46,8 @@ module FlashFlow
|
|
46
46
|
private
|
47
47
|
|
48
48
|
def mock_current_sha(branch, sha)
|
49
|
-
@git.expect(:
|
49
|
+
@git.expect(:remote, 'origin')
|
50
|
+
@git.expect(:get_sha, sha, ["origin/#{branch.ref}"])
|
50
51
|
end
|
51
52
|
|
52
53
|
def mock_working_branch(branch)
|
@@ -54,9 +55,9 @@ module FlashFlow
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def sample_branches
|
57
|
-
@sample_branches ||= [Data::Branch.from_hash({'ref' => 'branch0', '
|
58
|
-
Data::Branch.from_hash({'ref' => 'branch1', '
|
59
|
-
Data::Branch.from_hash({'ref' => 'branch2', '
|
58
|
+
@sample_branches ||= [Data::Branch.from_hash({'ref' => 'branch0', 'sha' => 'sha0', 'merge_order' => 1}),
|
59
|
+
Data::Branch.from_hash({'ref' => 'branch1', 'sha' => 'sha1', 'merge_order' => 2}),
|
60
|
+
Data::Branch.from_hash({'ref' => 'branch2', 'sha' => 'sha2', 'merge_order' => 3})]
|
60
61
|
end
|
61
62
|
|
62
63
|
def mergeable_order(*order)
|
data/test/lib/test_resolve.rb
CHANGED
@@ -35,16 +35,14 @@ module FlashFlow
|
|
35
35
|
|
36
36
|
def setup
|
37
37
|
@resolve_tester = ResolveTester.new({ 'merge_branch' => 'test_acceptance',
|
38
|
-
'
|
38
|
+
'remote' => 'test_remote',
|
39
39
|
'master_branch' => 'test_master',
|
40
|
-
'remotes' => ['fake_origin'],
|
41
40
|
'use_rerere' => true
|
42
41
|
}, 'some_file')
|
43
42
|
|
44
43
|
@resolve = Resolve.new({ 'merge_branch' => 'test_acceptance',
|
45
|
-
'
|
44
|
+
'remote' => 'test_remote',
|
46
45
|
'master_branch' => 'test_master',
|
47
|
-
'remotes' => ['fake_origin'],
|
48
46
|
'use_rerere' => true
|
49
47
|
}, 'some_file')
|
50
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash_flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flashfunders
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|