flash_flow 1.2.2.a → 1.2.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/lib/flash_flow/cmd_runner.rb +5 -21
- data/lib/flash_flow/data/base.rb +11 -1
- data/lib/flash_flow/data/store.rb +2 -4
- data/lib/flash_flow/deploy.rb +48 -31
- data/lib/flash_flow/git.rb +11 -25
- data/lib/flash_flow/issue_tracker.rb +1 -1
- data/lib/flash_flow/merge_master/status.rb +1 -1
- data/lib/flash_flow/resolve.rb +35 -18
- data/lib/flash_flow/shadow_repo.rb +14 -7
- data/lib/flash_flow/version.rb +1 -1
- data/test/lib/data/test_store.rb +0 -3
- data/test/lib/test_deploy.rb +8 -6
- data/test/lib/test_git.rb +4 -4
- data/test/lib/test_resolve.rb +29 -0
- data/test/minitest_helper.rb +4 -6
- metadata +4 -5
- data/update_gem.sh +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 480c4ebd2a6e87fca847937c52df8d2bcce3fe1b
|
4
|
+
data.tar.gz: 17458d805ba1ff604dcab78567ff3c2d6b774db7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c5c8288f8c367a4ec7bbe0b74f62bab3c3a446b1ade5a8d17486b2ff3c67463c4dcb496e2b1eeba8681391370a408c12642efdf5c01d271873c122e7c2be03
|
7
|
+
data.tar.gz: 46b479386cd464a43668c16e231141754db19f49c5477bfe7daf44681d4b0aa3f15a9db0f65288c54ae7cf9a99297acfb55bc4c6e9ddbd001764de0875d1f901
|
data/Gemfile.lock
CHANGED
@@ -3,11 +3,7 @@ require 'open3'
|
|
3
3
|
|
4
4
|
module FlashFlow
|
5
5
|
class CmdRunner
|
6
|
-
|
7
|
-
LOG_CMD = :log_cmd
|
8
|
-
|
9
|
-
attr_reader :dry_run, :last_command, :last_stderr, :last_stdout
|
10
|
-
attr_accessor :dir
|
6
|
+
attr_reader :dry_run, :dir, :last_command, :last_stderr, :last_stdout
|
11
7
|
|
12
8
|
def initialize(opts={})
|
13
9
|
@dir = opts[:dir] || '.'
|
@@ -15,7 +11,7 @@ module FlashFlow
|
|
15
11
|
@logger = opts[:logger] || Logger.new('/dev/null')
|
16
12
|
end
|
17
13
|
|
18
|
-
def run(cmd
|
14
|
+
def run(cmd)
|
19
15
|
@last_command = cmd
|
20
16
|
if dry_run
|
21
17
|
puts "#{dir}$ #{cmd}"
|
@@ -28,26 +24,14 @@ module FlashFlow
|
|
28
24
|
@success = wait_thr.value.success?
|
29
25
|
end
|
30
26
|
end
|
31
|
-
|
27
|
+
@logger.debug("#{dir}$ #{cmd}")
|
28
|
+
last_stdout.split("\n").each { |line| @logger.debug(line) }
|
29
|
+
last_stderr.split("\n").each { |line| @logger.debug(line) }
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
33
|
def last_success?
|
36
34
|
@success
|
37
35
|
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def log(cmd, log_what)
|
42
|
-
if log_what == LOG_NONE
|
43
|
-
# Do nothing
|
44
|
-
else
|
45
|
-
@logger.debug("#{dir}$ #{cmd}")
|
46
|
-
unless log_what == LOG_CMD
|
47
|
-
last_stdout.split("\n").each { |line| @logger.debug(line) }
|
48
|
-
last_stderr.split("\n").each { |line| @logger.debug(line) }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
36
|
end
|
53
37
|
end
|
data/lib/flash_flow/data/base.rb
CHANGED
@@ -46,7 +46,9 @@ module FlashFlow
|
|
46
46
|
|
47
47
|
def backwards_compatible_store
|
48
48
|
@backwards_compatible_store ||= begin
|
49
|
-
hash =
|
49
|
+
hash = in_shadow_repo do
|
50
|
+
@store.get
|
51
|
+
end
|
50
52
|
|
51
53
|
hash.has_key?('branches') ? hash : { 'branches' => hash }
|
52
54
|
end
|
@@ -55,6 +57,14 @@ module FlashFlow
|
|
55
57
|
def saved_branches
|
56
58
|
Collection.from_hash(@git.remotes, backwards_compatible_store['branches']).to_a
|
57
59
|
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def in_shadow_repo
|
64
|
+
ShadowRepo.new(@git).in_dir do
|
65
|
+
yield
|
66
|
+
end
|
67
|
+
end
|
58
68
|
end
|
59
69
|
end
|
60
70
|
end
|
@@ -20,14 +20,12 @@ module FlashFlow
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def write(branches, file=nil)
|
23
|
-
@git.
|
23
|
+
@git.in_temp_merge_branch do
|
24
24
|
file ||= File.open(@filename, 'w')
|
25
25
|
file.puts JSON.pretty_generate(sort_branches(branches))
|
26
26
|
file.close
|
27
|
-
end
|
28
27
|
|
29
|
-
|
30
|
-
@git.add_and_commit(@filename, 'Branch Info', add: {force: true})
|
28
|
+
@git.add_and_commit(@filename, 'Branch Info', add: { force: true })
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
data/lib/flash_flow/deploy.rb
CHANGED
@@ -18,8 +18,7 @@ module FlashFlow
|
|
18
18
|
@rerere_forget = opts[:rerere_forget]
|
19
19
|
@stories = [opts[:stories]].flatten.compact
|
20
20
|
|
21
|
-
@
|
22
|
-
@git = ShadowGit.new(Config.configuration.git, logger)
|
21
|
+
@git = Git.new(Config.configuration.git, logger)
|
23
22
|
@lock = Lock::Base.new(Config.configuration.lock)
|
24
23
|
@notifier = Notifier::Base.new(Config.configuration.notifier)
|
25
24
|
@data = Data::Base.new(Config.configuration.branches, Config.configuration.branch_info_file, @git, logger: logger)
|
@@ -32,42 +31,45 @@ module FlashFlow
|
|
32
31
|
def run
|
33
32
|
check_version
|
34
33
|
check_repo
|
35
|
-
puts "Building #{@
|
36
|
-
logger.info "\n\n### Beginning #{@
|
34
|
+
puts "Building #{@git.merge_branch}... Log can be found in #{FlashFlow::Config.configuration.log_file}"
|
35
|
+
logger.info "\n\n### Beginning #{@git.merge_branch} merge ###\n\n"
|
36
|
+
|
37
37
|
|
38
38
|
begin
|
39
39
|
open_pull_request
|
40
40
|
|
41
|
-
|
42
|
-
@
|
43
|
-
|
44
|
-
@git.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
41
|
+
in_shadow_repo do
|
42
|
+
@lock.with_lock do
|
43
|
+
fetch(@git.merge_remote)
|
44
|
+
@git.in_original_merge_branch do
|
45
|
+
@git.initialize_rerere
|
46
|
+
end
|
47
|
+
|
48
|
+
@git.reset_temp_merge_branch
|
49
|
+
@git.in_temp_merge_branch do
|
50
|
+
merge_branches
|
51
|
+
commit_branch_info
|
52
|
+
commit_rerere
|
53
|
+
end
|
54
|
+
|
55
|
+
@git.copy_temp_to_merge_branch
|
56
|
+
@git.delete_temp_merge_branch
|
57
|
+
@git.push_merge_branch
|
52
58
|
end
|
53
|
-
|
54
|
-
@git.copy_temp_to_merge_branch
|
55
|
-
@git.delete_temp_merge_branch
|
56
|
-
@git.push_merge_branch
|
57
59
|
end
|
58
60
|
|
59
61
|
print_errors
|
60
|
-
logger.info "### Finished #{@
|
62
|
+
logger.info "### Finished #{@git.merge_branch} merge ###"
|
61
63
|
rescue Lock::Error, OutOfSyncWithRemote => e
|
62
64
|
puts 'Failure!'
|
63
65
|
puts e.message
|
64
66
|
ensure
|
65
|
-
@
|
67
|
+
@git.run("checkout #{@git.working_branch}")
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
69
71
|
def check_repo
|
70
|
-
if @
|
72
|
+
if @git.staged_and_working_dir_files.any?
|
71
73
|
raise RuntimeError.new('You have changes in your working directory. Please stash and try again')
|
72
74
|
end
|
73
75
|
end
|
@@ -110,7 +112,7 @@ module FlashFlow
|
|
110
112
|
raise RuntimeError.new("No remote found for #{branch.remote_url}. Please run 'git remote add *your_remote_name* #{branch.remote_url}' and try again.")
|
111
113
|
end
|
112
114
|
|
113
|
-
|
115
|
+
fetch(branch.remote)
|
114
116
|
git_merge(branch, branch.ref == @git.working_branch)
|
115
117
|
end
|
116
118
|
end
|
@@ -140,17 +142,17 @@ module FlashFlow
|
|
140
142
|
end
|
141
143
|
|
142
144
|
def open_pull_request
|
143
|
-
return false if [@
|
145
|
+
return false if [@git.master_branch, @git.merge_branch].include?(@git.working_branch)
|
144
146
|
|
145
147
|
# TODO - This should use the actual remote for the branch we're on
|
146
|
-
@
|
147
|
-
raise OutOfSyncWithRemote.new("Your branch is out of sync with the remote. If you want to force push, run 'flash_flow -f'") unless @
|
148
|
+
@git.push(@git.working_branch, force: @force)
|
149
|
+
raise OutOfSyncWithRemote.new("Your branch is out of sync with the remote. If you want to force push, run 'flash_flow -f'") unless @git.last_success?
|
148
150
|
|
149
151
|
# TODO - This should use the actual remote for the branch we're on
|
150
152
|
if @do_not_merge
|
151
|
-
@data.remove_from_merge(@
|
153
|
+
@data.remove_from_merge(@git.merge_remote, @git.working_branch)
|
152
154
|
else
|
153
|
-
@data.add_to_merge(@
|
155
|
+
@data.add_to_merge(@git.merge_remote, @git.working_branch)
|
154
156
|
end
|
155
157
|
end
|
156
158
|
|
@@ -162,10 +164,10 @@ module FlashFlow
|
|
162
164
|
errors = []
|
163
165
|
branch_not_merged = nil
|
164
166
|
@data.failures.each do |full_ref, failure|
|
165
|
-
if failure.ref == @
|
166
|
-
branch_not_merged = "ERROR: Your branch did not merge to #{@
|
167
|
+
if failure.ref == @git.working_branch
|
168
|
+
branch_not_merged = "ERROR: Your branch did not merge to #{@git.merge_branch}. Run 'flash_flow --resolve', fix the merge conflict(s) and then re-run this script\n"
|
167
169
|
else
|
168
|
-
errors << "WARNING: Unable to merge branch #{failure.remote}/#{failure.ref} to #{@
|
170
|
+
errors << "WARNING: Unable to merge branch #{failure.remote}/#{failure.ref} to #{@git.merge_branch} due to conflicts."
|
169
171
|
end
|
170
172
|
end
|
171
173
|
errors << branch_not_merged if branch_not_merged
|
@@ -177,5 +179,20 @@ module FlashFlow
|
|
177
179
|
end
|
178
180
|
end
|
179
181
|
|
182
|
+
private
|
183
|
+
|
184
|
+
def in_shadow_repo
|
185
|
+
ShadowRepo.new(@git, logger: logger).in_dir do
|
186
|
+
yield
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def fetch(remote)
|
191
|
+
@fetched_remotes ||= {}
|
192
|
+
unless @fetched_remotes[remote]
|
193
|
+
@git.fetch(remote)
|
194
|
+
@fetched_remotes[remote] = true
|
195
|
+
end
|
196
|
+
end
|
180
197
|
end
|
181
198
|
end
|
data/lib/flash_flow/git.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'flash_flow/cmd_runner'
|
2
|
-
require 'shellwords'
|
3
2
|
|
4
3
|
module FlashFlow
|
5
4
|
class Git
|
@@ -23,12 +22,6 @@ module FlashFlow
|
|
23
22
|
@working_branch = current_branch
|
24
23
|
end
|
25
24
|
|
26
|
-
def in_dir
|
27
|
-
Dir.chdir(@cmd_runner.dir) do
|
28
|
-
yield
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
25
|
def last_stdout
|
33
26
|
@cmd_runner.last_stdout
|
34
27
|
end
|
@@ -41,8 +34,8 @@ module FlashFlow
|
|
41
34
|
@cmd_runner.last_success?
|
42
35
|
end
|
43
36
|
|
44
|
-
def run(cmd
|
45
|
-
@cmd_runner.run("git #{cmd}"
|
37
|
+
def run(cmd)
|
38
|
+
@cmd_runner.run("git #{cmd}")
|
46
39
|
end
|
47
40
|
|
48
41
|
def add_and_commit(files, message, opts={})
|
@@ -60,11 +53,7 @@ module FlashFlow
|
|
60
53
|
end
|
61
54
|
|
62
55
|
def fetch(remote)
|
63
|
-
|
64
|
-
unless @fetched_remotes[remote]
|
65
|
-
run("fetch #{remote}")
|
66
|
-
@fetched_remotes[remote] = true
|
67
|
-
end
|
56
|
+
run("fetch #{remote}")
|
68
57
|
end
|
69
58
|
|
70
59
|
def master_branch_contains?(ref)
|
@@ -84,7 +73,7 @@ module FlashFlow
|
|
84
73
|
end
|
85
74
|
|
86
75
|
def read_file_from_merge_branch(filename)
|
87
|
-
run("show #{merge_remote}/#{merge_branch}:#{filename}"
|
76
|
+
run("show #{merge_remote}/#{merge_branch}:#{filename}")
|
88
77
|
last_stdout
|
89
78
|
end
|
90
79
|
|
@@ -124,11 +113,9 @@ module FlashFlow
|
|
124
113
|
end
|
125
114
|
|
126
115
|
def unresolved_conflicts
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end.compact
|
131
|
-
end
|
116
|
+
conflicted_files.map do |file|
|
117
|
+
File.open(file) { |f| f.grep(/>>>>/) }.empty? ? nil : file
|
118
|
+
end.compact
|
132
119
|
end
|
133
120
|
|
134
121
|
def resolutions(files)
|
@@ -141,10 +128,10 @@ module FlashFlow
|
|
141
128
|
|
142
129
|
# git rerere doesn't give you a deterministic way to determine which resolution was used
|
143
130
|
def resolution_candidates(file)
|
144
|
-
@cmd_runner.run("diff -q --from-file #{file} .git/rr-cache/*/postimage"
|
131
|
+
@cmd_runner.run("diff -q --from-file #{file} .git/rr-cache/*/postimage")
|
145
132
|
different_files = split_diff_lines(@cmd_runner.last_stdout)
|
146
133
|
|
147
|
-
@cmd_runner.run('ls -la .git/rr-cache/*/postimage'
|
134
|
+
@cmd_runner.run('ls -la .git/rr-cache/*/postimage')
|
148
135
|
all_files = split_diff_lines(@cmd_runner.last_stdout)
|
149
136
|
|
150
137
|
all_files - different_files
|
@@ -250,15 +237,14 @@ module FlashFlow
|
|
250
237
|
|
251
238
|
def squash_commits
|
252
239
|
# There are three commits created by flash flow that we don't need in the message
|
253
|
-
run("log #{merge_remote}/#{merge_branch}..#{merge_branch}~3"
|
240
|
+
run("log #{merge_remote}/#{merge_branch}..#{merge_branch}~3")
|
254
241
|
log = last_stdout
|
255
242
|
|
256
243
|
# Get all the files that differ between existing acceptance and new acceptance
|
257
244
|
run("diff --name-only #{merge_remote}/#{merge_branch} #{merge_branch}")
|
258
245
|
files = last_stdout.split("\n")
|
259
246
|
run("reset #{merge_remote}/#{merge_branch}")
|
260
|
-
|
261
|
-
run("add -f #{files.map { |f| "\"#{Shellwords.escape(f)}\"" }.join(" ")}")
|
247
|
+
run("add #{files.map { |f| "'#{f}'" }.join(" ")}")
|
262
248
|
|
263
249
|
run("commit -m '#{commit_message(log)}'")
|
264
250
|
end
|
@@ -7,7 +7,7 @@ module FlashFlow
|
|
7
7
|
|
8
8
|
def initialize(issue_tracker_config, branches_config, branch_info_file, git_config, opts={})
|
9
9
|
@issue_tracker = IssueTracker::Base.new(issue_tracker_config)
|
10
|
-
@collection = Data::Base.new(branches_config, branch_info_file,
|
10
|
+
@collection = Data::Base.new(branches_config, branch_info_file, Git.new(git_config)).merged_branches
|
11
11
|
end
|
12
12
|
|
13
13
|
def status(filename=nil)
|
data/lib/flash_flow/resolve.rb
CHANGED
@@ -12,7 +12,7 @@ module FlashFlow
|
|
12
12
|
@logger = opts[:logger]
|
13
13
|
@branch_info_file = branch_info_file
|
14
14
|
@cmd_runner = CmdRunner.new(logger: @logger)
|
15
|
-
@git =
|
15
|
+
@git = Git.new(git_config, @logger)
|
16
16
|
end
|
17
17
|
|
18
18
|
def manual_instructions
|
@@ -23,22 +23,24 @@ module FlashFlow
|
|
23
23
|
def start
|
24
24
|
check_for_conflict
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
in_shadow_repo do
|
27
|
+
in_working_branch do
|
28
|
+
merge_conflicted
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
if unresolved_conflicts.empty?
|
31
|
+
puts "You have already resolved all conflicts."
|
32
|
+
else
|
33
|
+
launch_bash
|
33
34
|
|
34
|
-
|
35
|
+
rerere
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
unless unresolved_conflicts.empty?
|
38
|
+
puts "There are still unresolved conflicts in these files:\n#{unresolved_conflicts.join("\n")}\n\n"
|
39
|
+
end
|
38
40
|
end
|
39
|
-
end
|
40
41
|
|
41
|
-
|
42
|
+
git_reset
|
43
|
+
end
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -100,27 +102,42 @@ Run the following commands to fix the merge conflict and then re-run flash_flow:
|
|
100
102
|
private
|
101
103
|
|
102
104
|
def data
|
103
|
-
@data
|
105
|
+
return @data if @data
|
106
|
+
|
107
|
+
in_shadow_repo do
|
108
|
+
@data = Data::Base.new({}, @branch_info_file, @git, logger: @logger)
|
109
|
+
end
|
110
|
+
|
111
|
+
@data
|
112
|
+
|
104
113
|
end
|
105
114
|
|
106
115
|
def branch
|
107
116
|
@branch ||= data.saved_branches.detect { |branch| branch.ref == working_branch }
|
108
117
|
end
|
109
118
|
|
119
|
+
def shadow_repo
|
120
|
+
@shadow_repo ||= ShadowRepo.new(@git, logger: @logger)
|
121
|
+
end
|
122
|
+
|
123
|
+
def in_shadow_repo
|
124
|
+
shadow_repo.in_dir do
|
125
|
+
yield
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
110
129
|
def working_branch
|
111
130
|
@git.working_branch
|
112
131
|
end
|
113
132
|
|
114
133
|
def in_working_branch
|
115
|
-
@git.
|
116
|
-
|
117
|
-
yield
|
118
|
-
end
|
134
|
+
@git.in_branch(working_branch) do
|
135
|
+
yield
|
119
136
|
end
|
120
137
|
end
|
121
138
|
|
122
139
|
def flash_flow_directory
|
123
|
-
|
140
|
+
shadow_repo.flash_flow_dir
|
124
141
|
end
|
125
142
|
|
126
143
|
def init_file_contents
|
@@ -3,17 +3,24 @@ require 'logger'
|
|
3
3
|
require 'flash_flow/git'
|
4
4
|
|
5
5
|
module FlashFlow
|
6
|
-
class
|
6
|
+
class ShadowRepo
|
7
7
|
|
8
|
-
def initialize(config, logger=nil)
|
9
|
-
super
|
10
8
|
|
9
|
+
def initialize(git, opts={})
|
10
|
+
@git = git
|
11
|
+
@cmd_runner = CmdRunner.new(logger: opts[:logger])
|
12
|
+
end
|
13
|
+
|
14
|
+
def in_dir(opts={})
|
15
|
+
opts = { reset: true, go_back: true }.merge(opts)
|
11
16
|
create_shadow_repo
|
12
|
-
@cmd_runner.dir = flash_flow_dir
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
Dir.chdir(flash_flow_dir) do
|
19
|
+
@git.fetch(@git.merge_remote)
|
20
|
+
@git.run("reset --hard HEAD") if opts[:reset]
|
21
|
+
|
22
|
+
yield
|
23
|
+
end
|
17
24
|
end
|
18
25
|
|
19
26
|
def create_shadow_repo
|
data/lib/flash_flow/version.rb
CHANGED
data/test/lib/data/test_store.rb
CHANGED
data/test/lib/test_deploy.rb
CHANGED
@@ -59,7 +59,7 @@ module FlashFlow
|
|
59
59
|
|
60
60
|
current_branch_error = "ERROR: Your branch did not merge to test_acceptance. Run 'flash_flow --resolve', fix the merge conflict(s) and then re-run this script\n"
|
61
61
|
|
62
|
-
@deploy.instance_variable_get('@
|
62
|
+
@deploy.instance_variable_get('@git'.to_sym).stub(:working_branch, 'pushing_branch') do
|
63
63
|
assert_equal(current_branch_error, @deploy.format_errors)
|
64
64
|
end
|
65
65
|
end
|
@@ -73,10 +73,12 @@ module FlashFlow
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def test_check_out_to_working_branch
|
76
|
-
@deploy.stub(:
|
77
|
-
@deploy.stub(:
|
78
|
-
|
79
|
-
|
76
|
+
@deploy.stub(:in_shadow_repo, true) do
|
77
|
+
@deploy.stub(:check_repo, true) do
|
78
|
+
@deploy.stub(:check_version, true) do
|
79
|
+
Lock::Base.stub_any_instance(:with_lock, -> { raise Lock::Error }) do
|
80
|
+
assert_output(/Failure!/) { @deploy.run }
|
81
|
+
end
|
80
82
|
end
|
81
83
|
end
|
82
84
|
end
|
@@ -135,7 +137,7 @@ module FlashFlow
|
|
135
137
|
|
136
138
|
def test_ignore_pushing_master_or_acceptance
|
137
139
|
['test_master', 'test_acceptance'].each do |branch|
|
138
|
-
@deploy.instance_variable_get('@
|
140
|
+
@deploy.instance_variable_get('@git'.to_sym).stub(:working_branch, branch) do
|
139
141
|
refute(@deploy.open_pull_request)
|
140
142
|
end
|
141
143
|
end
|
data/test/lib/test_git.rb
CHANGED
@@ -40,15 +40,15 @@ module FlashFlow
|
|
40
40
|
@cmd_runner.expect(:run, true, ['rm -rf rr-cache/*'])
|
41
41
|
@cmd_runner.expect(:run, true, ['cp -R .git/rr-cache/xyz rr-cache/'])
|
42
42
|
@cmd_runner.expect(:run, true, ['cp -R .git/rr-cache/abc rr-cache/'])
|
43
|
-
@cmd_runner.expect(:run, true, ['git add rr-cache/'
|
44
|
-
@cmd_runner.expect(:run, true, ["git commit -m 'Update rr-cache'"
|
43
|
+
@cmd_runner.expect(:run, true, ['git add rr-cache/'])
|
44
|
+
@cmd_runner.expect(:run, true, ["git commit -m 'Update rr-cache'"])
|
45
45
|
|
46
46
|
instance.commit_rerere(['xyz', 'abc'])
|
47
47
|
@cmd_runner.verify
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_read_file_from_merge_branch
|
51
|
-
@cmd_runner.expect(:run, true, ["git show origin/acceptance:SomeFilename.txt"
|
51
|
+
@cmd_runner.expect(:run, true, ["git show origin/acceptance:SomeFilename.txt"])
|
52
52
|
@cmd_runner.expect(:last_stdout, 'some_json', [])
|
53
53
|
@git_args['use_rerere'] = false
|
54
54
|
|
@@ -65,7 +65,7 @@ module FlashFlow
|
|
65
65
|
|
66
66
|
def setup_cmd_runner
|
67
67
|
cmd_runner = Minitest::Mock.new
|
68
|
-
cmd_runner.expect(:run, true, ['git rev-parse --abbrev-ref HEAD'
|
68
|
+
cmd_runner.expect(:run, true, ['git rev-parse --abbrev-ref HEAD'])
|
69
69
|
cmd_runner.expect(:last_stdout, 'current_branch', [])
|
70
70
|
cmd_runner
|
71
71
|
end
|
data/test/lib/test_resolve.rb
CHANGED
@@ -4,6 +4,10 @@ module FlashFlow
|
|
4
4
|
class TestResolve< Minitest::Test
|
5
5
|
|
6
6
|
class ResolveTester < Resolve
|
7
|
+
def in_shadow_repo
|
8
|
+
yield
|
9
|
+
end
|
10
|
+
|
7
11
|
def in_working_branch
|
8
12
|
yield
|
9
13
|
end
|
@@ -67,5 +71,30 @@ module FlashFlow
|
|
67
71
|
end
|
68
72
|
end
|
69
73
|
|
74
|
+
|
75
|
+
|
76
|
+
# def start
|
77
|
+
# if unresolved_conflicts.empty?
|
78
|
+
# puts "You have already resolved all conflicts."
|
79
|
+
# else
|
80
|
+
# launch_bash
|
81
|
+
# @git.run("rerere")
|
82
|
+
#
|
83
|
+
# unless unresolved_conflicts.empty?
|
84
|
+
# puts "There are still unresolved conflicts in these files:\n#{unresolved_conflicts.join("\n")}\n\n"
|
85
|
+
# end
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# @git.run("reset --hard HEAD")
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
# end
|
92
|
+
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def shadow_repo
|
97
|
+
Minitest::Mock.new.expect(:in_dir, true)
|
98
|
+
end
|
70
99
|
end
|
71
100
|
end
|
data/test/minitest_helper.rb
CHANGED
@@ -7,13 +7,11 @@ ENV['GH_TOKEN'] = 'fake_token'
|
|
7
7
|
class Minitest::Test
|
8
8
|
|
9
9
|
class TestCmdRunner < Minitest::Mock
|
10
|
-
LOG_NONE = :log_none
|
11
|
-
LOG_CMD = :log_cmd
|
12
|
-
|
13
10
|
def initialize(opts={}); super(); end
|
14
|
-
def run(_
|
15
|
-
def last_success
|
16
|
-
|
11
|
+
def run(_); end
|
12
|
+
def last_success?
|
13
|
+
true
|
14
|
+
end
|
17
15
|
def last_stdout; ''; end
|
18
16
|
def last_stderr; ''; end
|
19
17
|
def last_command; ''; 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.2.2
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flashfunders
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -201,7 +201,6 @@ files:
|
|
201
201
|
- test/lib/test_notifier.rb
|
202
202
|
- test/lib/test_resolve.rb
|
203
203
|
- test/minitest_helper.rb
|
204
|
-
- update_gem.sh
|
205
204
|
homepage: https://github.com/FlashFunders/flash_flow
|
206
205
|
licenses:
|
207
206
|
- MIT
|
@@ -217,9 +216,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
216
|
version: '0'
|
218
217
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
218
|
requirements:
|
220
|
-
- - "
|
219
|
+
- - ">="
|
221
220
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
221
|
+
version: '0'
|
223
222
|
requirements: []
|
224
223
|
rubyforge_project:
|
225
224
|
rubygems_version: 2.2.2
|