git-multirepo 1.0.0.beta66 → 1.0.0.beta67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +4 -4
  3. data/.gitbugtraq +3 -3
  4. data/.gitignore +38 -38
  5. data/.rspec +2 -2
  6. data/.rubocop.yml +79 -79
  7. data/CHANGELOG.md +95 -95
  8. data/Gemfile +4 -4
  9. data/Gemfile.lock +47 -47
  10. data/LICENSE +22 -22
  11. data/README.md +178 -178
  12. data/Rakefile +1 -1
  13. data/bin/multi +11 -11
  14. data/docs/bug-repros/91565510-repro.sh +20 -20
  15. data/git-multirepo.gemspec +31 -31
  16. data/lib/git-multirepo.rb +3 -3
  17. data/lib/multirepo/commands/add-command.rb +51 -51
  18. data/lib/multirepo/commands/branch-command.rb +88 -88
  19. data/lib/multirepo/commands/checkout-command.rb +127 -127
  20. data/lib/multirepo/commands/clone-command.rb +68 -68
  21. data/lib/multirepo/commands/command.rb +87 -87
  22. data/lib/multirepo/commands/commands.rb +14 -14
  23. data/lib/multirepo/commands/do-command.rb +101 -101
  24. data/lib/multirepo/commands/init-command.rb +121 -121
  25. data/lib/multirepo/commands/inspect-command.rb +48 -48
  26. data/lib/multirepo/commands/install-command.rb +170 -170
  27. data/lib/multirepo/commands/merge-command.rb +251 -251
  28. data/lib/multirepo/commands/open-command.rb +55 -55
  29. data/lib/multirepo/commands/remove-command.rb +48 -48
  30. data/lib/multirepo/commands/uninit-command.rb +18 -18
  31. data/lib/multirepo/commands/update-command.rb +112 -112
  32. data/lib/multirepo/config.rb +19 -19
  33. data/lib/multirepo/files/config-entry.rb +39 -39
  34. data/lib/multirepo/files/config-file.rb +52 -52
  35. data/lib/multirepo/files/lock-entry.rb +29 -29
  36. data/lib/multirepo/files/lock-file.rb +62 -62
  37. data/lib/multirepo/files/meta-file.rb +51 -51
  38. data/lib/multirepo/files/tracking-file.rb +9 -9
  39. data/lib/multirepo/files/tracking-files.rb +64 -64
  40. data/lib/multirepo/git/branch.rb +32 -32
  41. data/lib/multirepo/git/change.rb +11 -11
  42. data/lib/multirepo/git/commit.rb +7 -7
  43. data/lib/multirepo/git/git-runner.rb +56 -56
  44. data/lib/multirepo/git/git.rb +10 -10
  45. data/lib/multirepo/git/ref.rb +38 -38
  46. data/lib/multirepo/git/remote.rb +17 -17
  47. data/lib/multirepo/git/repo.rb +129 -129
  48. data/lib/multirepo/hooks/post-commit-hook.rb +23 -23
  49. data/lib/multirepo/hooks/pre-commit-hook.rb +35 -35
  50. data/lib/multirepo/info.rb +5 -5
  51. data/lib/multirepo/logic/dependency.rb +6 -6
  52. data/lib/multirepo/logic/merge-descriptor.rb +95 -95
  53. data/lib/multirepo/logic/node.rb +75 -72
  54. data/lib/multirepo/logic/performer.rb +62 -55
  55. data/lib/multirepo/logic/repo-selection.rb +25 -25
  56. data/lib/multirepo/logic/revision-selection.rb +15 -15
  57. data/lib/multirepo/logic/revision-selector.rb +23 -23
  58. data/lib/multirepo/logic/version-comparer.rb +10 -10
  59. data/lib/multirepo/multirepo-exception.rb +6 -6
  60. data/lib/multirepo/output/extra-output.rb +12 -12
  61. data/lib/multirepo/output/teamcity-extra-output.rb +11 -11
  62. data/lib/multirepo/utility/console.rb +52 -52
  63. data/lib/multirepo/utility/popen-runner.rb +27 -27
  64. data/lib/multirepo/utility/system-runner.rb +14 -14
  65. data/lib/multirepo/utility/utils.rb +106 -99
  66. data/lib/multirepo/utility/verbosity.rb +6 -6
  67. data/resources/.gitconfig +2 -2
  68. data/resources/post-commit +0 -0
  69. data/resources/pre-commit +0 -0
  70. data/spec/integration/init_spec.rb +19 -19
  71. data/spec/spec_helper.rb +89 -89
  72. metadata +3 -3
@@ -1,251 +1,251 @@
1
- require "terminal-table"
2
-
3
- require "multirepo/utility/console"
4
- require "multirepo/utility/utils"
5
- require "multirepo/logic/node"
6
- require "multirepo/logic/revision-selector"
7
- require "multirepo/logic/repo-selection"
8
- require "multirepo/logic/performer"
9
- require "multirepo/logic/merge-descriptor"
10
- require "multirepo/files/tracking-files"
11
- require "multirepo/commands/update-command"
12
-
13
- module MultiRepo
14
- class MergeValidationResult
15
- ABORT = 0
16
- PROCEED = 1
17
- MERGE_UPSTREAM = 2
18
-
19
- attr_accessor :outcome
20
- attr_accessor :message
21
- end
22
-
23
- class MergeCommand < Command
24
- self.command = "merge"
25
- self.summary = "Performs a git merge on all dependencies and the main repo, in the proper order."
26
-
27
- def self.options
28
- [
29
- ['<refname>', 'The main repo tag, branch or commit id to merge.'],
30
- ['[--latest]', 'Merge the HEAD of each stored dependency branch instead of the commits recorded in the lock file.'],
31
- ['[--exact]', 'Merge the exact specified ref for each repo, regardless of what\'s stored in the lock file.'],
32
- ['[--no-ff]', 'Never perform a fast-forward.']
33
- ].concat(super)
34
- end
35
-
36
- def initialize(argv)
37
- @ref_name = argv.shift_argument
38
- @checkout_latest = argv.flag?("latest")
39
- @checkout_exact = argv.flag?("exact")
40
- @fast_forward = argv.flag?("ff")
41
- super
42
- end
43
-
44
- def validate!
45
- super
46
- help! "You must specify a ref to merge" unless @ref_name
47
- unless Utils.only_one_true?(@checkout_latest, @checkout_exact)
48
- help! "You can't provide more than one operation modifier (--latest, --exact, etc.)"
49
- end
50
- end
51
-
52
- def run
53
- ensure_in_work_tree
54
- ensure_multirepo_enabled
55
-
56
- # Find out the checkout mode based on command-line options
57
- mode = RevisionSelector.mode_for_args(@checkout_latest, @checkout_exact)
58
-
59
- strategy_name = RevisionSelection.name_for_mode(mode)
60
- Console.log_step("Merging #{@ref_name} with '#{strategy_name}' strategy...")
61
-
62
- main_repo = Repo.new(".")
63
-
64
- # Keep the initial revision because we're going to need to come back to it later
65
- initial_revision = main_repo.current_revision
66
-
67
- begin
68
- merge_core(main_repo, initial_revision, mode)
69
- rescue MultiRepoException => e
70
- # Revert to the initial revision only if necessary
71
- unless main_repo.current_revision == initial_revision
72
- Console.log_warning("Restoring working copy to #{initial_revision}")
73
- main_repo.checkout(initial_revision)
74
- end
75
- raise e
76
- end
77
-
78
- Console.log_step("Done!")
79
- end
80
-
81
- def merge_core(main_repo, initial_revision, mode)
82
- config_file = ConfigFile.new(".")
83
-
84
- # Ensure the main repo is clean
85
- fail MultiRepoException, "Main repo is not clean; merge aborted" unless main_repo.clean?
86
-
87
- # Ensure dependencies are clean
88
- unless Utils.dependencies_clean?(config_file.load_entries)
89
- fail MultiRepoException, "Dependencies are not clean; merge aborted"
90
- end
91
-
92
- ref_name = @ref_name
93
- descriptors = nil
94
- loop do
95
- # Gather information about the merges that would occur
96
- descriptors = build_merge(main_repo, initial_revision, ref_name, mode)
97
-
98
- # Preview merge operations in the console
99
- preview_merge(descriptors, mode, ref_name)
100
-
101
- # Validate merge operations
102
- result = ensure_merge_valid(descriptors)
103
-
104
- case result.outcome
105
- when MergeValidationResult::ABORT
106
- fail MultiRepoException, result.message
107
- when MergeValidationResult::PROCEED
108
- fail MultiRepoException, "Merge aborted" unless Console.ask("Proceed?")
109
- Console.log_warning(result.message) if result.message
110
- break
111
- when MergeValidationResult::MERGE_UPSTREAM
112
- Console.log_warning(result.message)
113
- fail MultiRepoException, "Merge aborted" unless Console.ask("Merge upstream instead of local branches?")
114
- # TODO: Modify operations!
115
- fail MultiRepoException, "Fallback behavior not implemented. Please merge manually."
116
- next
117
- end
118
-
119
- fail MultiRepoException, "Merge aborted" unless Console.ask("Proceed?")
120
- end
121
-
122
- Console.log_step("Performing merge...")
123
-
124
- all_succeeded = perform_merges(descriptors)
125
- ask_tracking_files_update(all_succeeded)
126
- end
127
-
128
- def build_merge(main_repo, initial_revision, ref_name, mode)
129
- # List dependencies prior to checkout so that we can compare them later
130
- our_dependencies = Performer.depth_ordered_dependencies
131
-
132
- # Checkout the specified main repo ref to find out which dependency refs to merge
133
- commit_id = Ref.new(main_repo, ref_name).commit_id # Checkout in floating HEAD
134
- Performer.perform_main_repo_checkout(main_repo, commit_id, false, "Checked out main repo '#{ref_name}' to inspect to-merge dependencies")
135
-
136
- # List dependencies for the ref we're trying to merge
137
- their_dependencies = Performer.depth_ordered_dependencies
138
-
139
- # Checkout the initial revision ASAP
140
- Performer.perform_main_repo_checkout(main_repo, initial_revision, false, "Checked out initial main repo revision '#{initial_revision}'")
141
-
142
- # Auto-merge would be too complex to implement (due to lots of edge cases)
143
- # if the specified ref does not have the same dependencies. Better perform a manual merge.
144
- ensure_dependencies_match(our_dependencies, their_dependencies)
145
-
146
- # Create a merge descriptor for each would-be merge as well as the main repo.
147
- # This step MUST be performed in OUR revision for the merge descriptors to be correct!
148
- descriptors = build_dependency_merge_descriptors(our_dependencies, their_dependencies, ref_name, mode)
149
- descriptors.push(MergeDescriptor.new("Main Repo", main_repo, initial_revision, ref_name))
150
-
151
- return descriptors
152
- end
153
-
154
- def build_dependency_merge_descriptors(our_dependencies, their_dependencies, ref_name, mode)
155
- descriptors = []
156
- our_dependencies.zip(their_dependencies).each do |our_dependency, their_dependency|
157
- our_revision = our_dependency.config_entry.repo.current_revision
158
-
159
- their_revision = RevisionSelector.revision_for_mode(mode, ref_name, their_dependency.lock_entry)
160
- their_name = their_dependency.config_entry.name
161
- their_repo = their_dependency.config_entry.repo
162
-
163
- descriptor = MergeDescriptor.new(their_name, their_repo, our_revision, their_revision)
164
-
165
- descriptors.push(descriptor)
166
- end
167
- return descriptors
168
- end
169
-
170
- def ensure_dependencies_match(our_dependencies, their_dependencies)
171
- our_dependencies.zip(their_dependencies).each do |our_dependency, their_dependency|
172
- if their_dependency.nil? || their_dependency.config_entry.id != our_dependency.config_entry.id
173
- fail MultiRepoException, "Dependencies differ, please merge manually"
174
- end
175
- end
176
-
177
- if their_dependencies.count > our_dependencies.count
178
- fail MultiRepoException, "There are more dependencies in the specified ref, please merge manually"
179
- end
180
- end
181
-
182
- def preview_merge(descriptors, mode, ref_name)
183
- Console.log_info("Merging would #{message_for_mode(mode, ref_name)}:")
184
-
185
- table = Terminal::Table.new do |t|
186
- descriptors.reverse.each_with_index do |descriptor, index|
187
- t.add_row [descriptor.name.bold, descriptor.merge_description, descriptor.upstream_description]
188
- t.add_separator unless index == descriptors.count - 1
189
- end
190
- end
191
- puts table
192
- end
193
-
194
- def ensure_merge_valid(descriptors)
195
- outcome = MergeValidationResult.new
196
- outcome.outcome = MergeValidationResult::PROCEED
197
-
198
- if descriptors.any? { |d| d.state == TheirState::LOCAL_NO_UPSTREAM }
199
- outcome.message = "Some branches are not remote-tracking! Please review the merge operations above."
200
- elsif descriptors.any? { |d| d.state == TheirState::LOCAL_UPSTREAM_DIVERGED }
201
- outcome.outcome = MergeValidationResult::ABORT
202
- outcome.message = "Some upstream branches have diverged. This warrants a manual merge!"
203
- elsif descriptors.any? { |d| d.state == TheirState::LOCAL_OUTDATED }
204
- outcome.outcome = MergeValidationResult::MERGE_UPSTREAM
205
- outcome.message = "Some local branches are outdated"
206
- end
207
-
208
- return outcome
209
- end
210
-
211
- def perform_merges(descriptors)
212
- success = true
213
- descriptors.each do |descriptor|
214
- Console.log_substep("#{descriptor.name} : Merging #{descriptor.their_revision} into #{descriptor.our_revision}...")
215
- GitRunner.run_as_system(descriptor.repo.path, "merge #{descriptor.their_revision}#{@fast_forward ? '' : ' --no-ff'}")
216
- success &= GitRunner.last_command_succeeded
217
- end
218
-
219
- if success
220
- Console.log_info("All merges performed successfully!")
221
- else
222
- Console.log_warning("Some merge operations failed. Please review the above.")
223
- end
224
-
225
- return success
226
- end
227
-
228
- def ask_tracking_files_update(all_merges_succeeded)
229
- unless all_merges_succeeded
230
- Console.log_warning("Perform a 'multi update' after resolving merge conflicts to ensure lock file contents are valid")
231
- return
232
- end
233
-
234
- return unless Console.ask("Update main repo tracking files? (important for continuous integration)")
235
-
236
- update_command = UpdateCommand.new(CLAide::ARGV.new(["--commit", "--diff"]))
237
- update_command.update_tracking_files_step(RepoSelection::MAIN)
238
- end
239
-
240
- def message_for_mode(mode, ref_name)
241
- case mode
242
- when RevisionSelection::AS_LOCK
243
- "merge specific commits as stored in the lock file for main repo revision #{ref_name}"
244
- when RevisionSelection::LATEST
245
- "merge each branch as stored in the lock file of main repo revision #{ref_name}"
246
- when RevisionSelection::EXACT
247
- "merge #{ref_name} for each repository, ignoring the contents of the lock file"
248
- end
249
- end
250
- end
251
- end
1
+ require "terminal-table"
2
+
3
+ require "multirepo/utility/console"
4
+ require "multirepo/utility/utils"
5
+ require "multirepo/logic/node"
6
+ require "multirepo/logic/revision-selector"
7
+ require "multirepo/logic/repo-selection"
8
+ require "multirepo/logic/performer"
9
+ require "multirepo/logic/merge-descriptor"
10
+ require "multirepo/files/tracking-files"
11
+ require "multirepo/commands/update-command"
12
+
13
+ module MultiRepo
14
+ class MergeValidationResult
15
+ ABORT = 0
16
+ PROCEED = 1
17
+ MERGE_UPSTREAM = 2
18
+
19
+ attr_accessor :outcome
20
+ attr_accessor :message
21
+ end
22
+
23
+ class MergeCommand < Command
24
+ self.command = "merge"
25
+ self.summary = "Performs a git merge on all dependencies and the main repo, in the proper order."
26
+
27
+ def self.options
28
+ [
29
+ ['<refname>', 'The main repo tag, branch or commit id to merge.'],
30
+ ['[--latest]', 'Merge the HEAD of each stored dependency branch instead of the commits recorded in the lock file.'],
31
+ ['[--exact]', 'Merge the exact specified ref for each repo, regardless of what\'s stored in the lock file.'],
32
+ ['[--no-ff]', 'Never perform a fast-forward.']
33
+ ].concat(super)
34
+ end
35
+
36
+ def initialize(argv)
37
+ @ref_name = argv.shift_argument
38
+ @checkout_latest = argv.flag?("latest")
39
+ @checkout_exact = argv.flag?("exact")
40
+ @fast_forward = argv.flag?("ff")
41
+ super
42
+ end
43
+
44
+ def validate!
45
+ super
46
+ help! "You must specify a ref to merge" unless @ref_name
47
+ unless Utils.only_one_true?(@checkout_latest, @checkout_exact)
48
+ help! "You can't provide more than one operation modifier (--latest, --exact, etc.)"
49
+ end
50
+ end
51
+
52
+ def run
53
+ ensure_in_work_tree
54
+ ensure_multirepo_enabled
55
+
56
+ # Find out the checkout mode based on command-line options
57
+ mode = RevisionSelector.mode_for_args(@checkout_latest, @checkout_exact)
58
+
59
+ strategy_name = RevisionSelection.name_for_mode(mode)
60
+ Console.log_step("Merging #{@ref_name} with '#{strategy_name}' strategy...")
61
+
62
+ main_repo = Repo.new(".")
63
+
64
+ # Keep the initial revision because we're going to need to come back to it later
65
+ initial_revision = main_repo.current_revision
66
+
67
+ begin
68
+ merge_core(main_repo, initial_revision, mode)
69
+ rescue MultiRepoException => e
70
+ # Revert to the initial revision only if necessary
71
+ unless main_repo.current_revision == initial_revision
72
+ Console.log_warning("Restoring working copy to #{initial_revision}")
73
+ main_repo.checkout(initial_revision)
74
+ end
75
+ raise e
76
+ end
77
+
78
+ Console.log_step("Done!")
79
+ end
80
+
81
+ def merge_core(main_repo, initial_revision, mode)
82
+ config_file = ConfigFile.new(".")
83
+
84
+ # Ensure the main repo is clean
85
+ fail MultiRepoException, "Main repo is not clean; merge aborted" unless main_repo.clean?
86
+
87
+ # Ensure dependencies are clean
88
+ unless Utils.dependencies_clean?(config_file.load_entries)
89
+ fail MultiRepoException, "Dependencies are not clean; merge aborted"
90
+ end
91
+
92
+ ref_name = @ref_name
93
+ descriptors = nil
94
+ loop do
95
+ # Gather information about the merges that would occur
96
+ descriptors = build_merge(main_repo, initial_revision, ref_name, mode)
97
+
98
+ # Preview merge operations in the console
99
+ preview_merge(descriptors, mode, ref_name)
100
+
101
+ # Validate merge operations
102
+ result = ensure_merge_valid(descriptors)
103
+
104
+ case result.outcome
105
+ when MergeValidationResult::ABORT
106
+ fail MultiRepoException, result.message
107
+ when MergeValidationResult::PROCEED
108
+ fail MultiRepoException, "Merge aborted" unless Console.ask("Proceed?")
109
+ Console.log_warning(result.message) if result.message
110
+ break
111
+ when MergeValidationResult::MERGE_UPSTREAM
112
+ Console.log_warning(result.message)
113
+ fail MultiRepoException, "Merge aborted" unless Console.ask("Merge upstream instead of local branches?")
114
+ # TODO: Modify operations!
115
+ fail MultiRepoException, "Fallback behavior not implemented. Please merge manually."
116
+ next
117
+ end
118
+
119
+ fail MultiRepoException, "Merge aborted" unless Console.ask("Proceed?")
120
+ end
121
+
122
+ Console.log_step("Performing merge...")
123
+
124
+ all_succeeded = perform_merges(descriptors)
125
+ ask_tracking_files_update(all_succeeded)
126
+ end
127
+
128
+ def build_merge(main_repo, initial_revision, ref_name, mode)
129
+ # List dependencies prior to checkout so that we can compare them later
130
+ our_dependencies = Performer.depth_ordered_dependencies
131
+
132
+ # Checkout the specified main repo ref to find out which dependency refs to merge
133
+ commit_id = Ref.new(main_repo, ref_name).commit_id # Checkout in floating HEAD
134
+ Performer.perform_main_repo_checkout(main_repo, commit_id, false, "Checked out main repo '#{ref_name}' to inspect to-merge dependencies")
135
+
136
+ # List dependencies for the ref we're trying to merge
137
+ their_dependencies = Performer.depth_ordered_dependencies
138
+
139
+ # Checkout the initial revision ASAP
140
+ Performer.perform_main_repo_checkout(main_repo, initial_revision, false, "Checked out initial main repo revision '#{initial_revision}'")
141
+
142
+ # Auto-merge would be too complex to implement (due to lots of edge cases)
143
+ # if the specified ref does not have the same dependencies. Better perform a manual merge.
144
+ ensure_dependencies_match(our_dependencies, their_dependencies)
145
+
146
+ # Create a merge descriptor for each would-be merge as well as the main repo.
147
+ # This step MUST be performed in OUR revision for the merge descriptors to be correct!
148
+ descriptors = build_dependency_merge_descriptors(our_dependencies, their_dependencies, ref_name, mode)
149
+ descriptors.push(MergeDescriptor.new("Main Repo", main_repo, initial_revision, ref_name))
150
+
151
+ return descriptors
152
+ end
153
+
154
+ def build_dependency_merge_descriptors(our_dependencies, their_dependencies, ref_name, mode)
155
+ descriptors = []
156
+ our_dependencies.zip(their_dependencies).each do |our_dependency, their_dependency|
157
+ our_revision = our_dependency.config_entry.repo.current_revision
158
+
159
+ their_revision = RevisionSelector.revision_for_mode(mode, ref_name, their_dependency.lock_entry)
160
+ their_name = their_dependency.config_entry.name
161
+ their_repo = their_dependency.config_entry.repo
162
+
163
+ descriptor = MergeDescriptor.new(their_name, their_repo, our_revision, their_revision)
164
+
165
+ descriptors.push(descriptor)
166
+ end
167
+ return descriptors
168
+ end
169
+
170
+ def ensure_dependencies_match(our_dependencies, their_dependencies)
171
+ our_dependencies.zip(their_dependencies).each do |our_dependency, their_dependency|
172
+ if their_dependency.nil? || their_dependency.config_entry.id != our_dependency.config_entry.id
173
+ fail MultiRepoException, "Dependencies differ, please merge manually"
174
+ end
175
+ end
176
+
177
+ if their_dependencies.count > our_dependencies.count
178
+ fail MultiRepoException, "There are more dependencies in the specified ref, please merge manually"
179
+ end
180
+ end
181
+
182
+ def preview_merge(descriptors, mode, ref_name)
183
+ Console.log_info("Merging would #{message_for_mode(mode, ref_name)}:")
184
+
185
+ table = Terminal::Table.new do |t|
186
+ descriptors.reverse.each_with_index do |descriptor, index|
187
+ t.add_row [descriptor.name.bold, descriptor.merge_description, descriptor.upstream_description]
188
+ t.add_separator unless index == descriptors.count - 1
189
+ end
190
+ end
191
+ puts table
192
+ end
193
+
194
+ def ensure_merge_valid(descriptors)
195
+ outcome = MergeValidationResult.new
196
+ outcome.outcome = MergeValidationResult::PROCEED
197
+
198
+ if descriptors.any? { |d| d.state == TheirState::LOCAL_NO_UPSTREAM }
199
+ outcome.message = "Some branches are not remote-tracking! Please review the merge operations above."
200
+ elsif descriptors.any? { |d| d.state == TheirState::LOCAL_UPSTREAM_DIVERGED }
201
+ outcome.outcome = MergeValidationResult::ABORT
202
+ outcome.message = "Some upstream branches have diverged. This warrants a manual merge!"
203
+ elsif descriptors.any? { |d| d.state == TheirState::LOCAL_OUTDATED }
204
+ outcome.outcome = MergeValidationResult::MERGE_UPSTREAM
205
+ outcome.message = "Some local branches are outdated"
206
+ end
207
+
208
+ return outcome
209
+ end
210
+
211
+ def perform_merges(descriptors)
212
+ success = true
213
+ descriptors.each do |descriptor|
214
+ Console.log_substep("#{descriptor.name} : Merging #{descriptor.their_revision} into #{descriptor.our_revision}...")
215
+ GitRunner.run_as_system(descriptor.repo.path, "merge #{descriptor.their_revision}#{@fast_forward ? '' : ' --no-ff'}")
216
+ success &= GitRunner.last_command_succeeded
217
+ end
218
+
219
+ if success
220
+ Console.log_info("All merges performed successfully!")
221
+ else
222
+ Console.log_warning("Some merge operations failed. Please review the above.")
223
+ end
224
+
225
+ return success
226
+ end
227
+
228
+ def ask_tracking_files_update(all_merges_succeeded)
229
+ unless all_merges_succeeded
230
+ Console.log_warning("Perform a 'multi update' after resolving merge conflicts to ensure lock file contents are valid")
231
+ return
232
+ end
233
+
234
+ return unless Console.ask("Update main repo tracking files? (important for continuous integration)")
235
+
236
+ update_command = UpdateCommand.new(CLAide::ARGV.new(["--commit", "--diff"]))
237
+ update_command.update_tracking_files_step(RepoSelection::MAIN)
238
+ end
239
+
240
+ def message_for_mode(mode, ref_name)
241
+ case mode
242
+ when RevisionSelection::AS_LOCK
243
+ "merge specific commits as stored in the lock file for main repo revision #{ref_name}"
244
+ when RevisionSelection::LATEST
245
+ "merge each branch as stored in the lock file of main repo revision #{ref_name}"
246
+ when RevisionSelection::EXACT
247
+ "merge #{ref_name} for each repository, ignoring the contents of the lock file"
248
+ end
249
+ end
250
+ end
251
+ end