@@ -19,12 +19,12 @@ class RoboFile extends \Robo\Tasks
19
19
*
20
20
* @param array $options
21
21
* @option $repository-url URI of Git repository (HTTPS/SSH/FILE)
22
- * @option $working-directory Working directory to checkout repositories
22
+ * @option $working-directory Working directory to check out repositories
23
23
* @option $patch-source-directory Source directory for all collected patches
24
24
* @option $patch-name Name of the directory where the patch code resides
25
25
* @option $source-branch Name of the branch to create a new branch upon
26
26
* @option $branch-name Name of the feature branch to be created
27
- * @option $halt-before-commit Pause before changes are commited , asks to continue
27
+ * @option $halt-before-commit Pause before changes are committed , asks to continue
28
28
* @return int exit code
29
29
* @throws TaskException
30
30
*/
@@ -84,9 +84,9 @@ public function patch(array $options = [
84
84
*
85
85
* @param array $options
86
86
* @option $repository-url URI of Git repository (HTTPS/SSH/FILE)
87
- * @option $working-directory Working directory to checkout repositories
88
- * @option $source Source branch name (eg . feature branch)
89
- * @option $target Target branch name (eg . main branch)
87
+ * @option $working-directory Working directory to check out repositories
88
+ * @option $source Source branch name (e.g . feature branch)
89
+ * @option $target Target branch name (e.g . main branch)
90
90
* @return int exit code
91
91
* @throws TaskException
92
92
*/
@@ -184,11 +184,12 @@ public function create(array $options = [
184
184
*
185
185
* @param string $batchCommand Name of command to run in batch mode (patch or merge, default: patch)
186
186
* @param array $options
187
- * @option $working-directory Working directory to checkout repositories
187
+ * @option $working-directory Working directory to check out repositories
188
188
* @option $patch-source-directory Source directory for all collected patches
189
189
* @option $patch-name Name of the directory where the patch code resides
190
190
* @option $branch-name Name of the feature branch to be created
191
- * @option $halt-before-commit Pause before changes are commited, asks to continue
191
+ * @option $halt-before-commit Pause before changes are committed, asks to continue
192
+ * @option $source Source branch name (e.g. feature branch)
192
193
* @return int exit code
193
194
* @throws TaskException
194
195
*/
@@ -198,6 +199,7 @@ public function batch(string $batchCommand, array $options = [
198
199
'patch-name|p ' => 'template ' ,
199
200
'branch-name ' => null ,
200
201
'halt-before-commit ' => false ,
202
+ 'source ' => null
201
203
]): int
202
204
{
203
205
$ workingDirectory = getcwd ();
@@ -214,18 +216,32 @@ public function batch(string $batchCommand, array $options = [
214
216
});
215
217
array_shift ($ repositories ); // remove column header
216
218
217
- foreach ($ repositories as $ repository ) {
218
- /** @noinspection DisconnectedForeachInstructionInspection */
219
- chdir ($ workingDirectory ); // reset working directory
220
- $ this ->patch ([
221
- 'repository-url ' => $ repository [0 ],
222
- 'working-directory ' => $ options ['working-directory ' ],
223
- 'patch-source-directory ' => $ options ['patch-source-directory ' ],
224
- 'patch-name ' => $ options ['patch-name ' ],
225
- 'source-branch ' => $ repository [1 ],
226
- 'branch-name ' => $ options ['branch-name ' ],
227
- 'halt-before-commit ' => $ options ['halt-before-commit ' ],
228
- ]);
219
+ if ($ batchCommand === 'patch ' ) {
220
+ foreach ($ repositories as $ repository ) {
221
+ /** @noinspection DisconnectedForeachInstructionInspection */
222
+ chdir ($ workingDirectory ); // reset working directory
223
+ $ this ->patch ([
224
+ 'repository-url ' => $ repository [0 ],
225
+ 'working-directory ' => $ options ['working-directory ' ],
226
+ 'patch-source-directory ' => $ options ['patch-source-directory ' ],
227
+ 'patch-name ' => $ options ['patch-name ' ],
228
+ 'source-branch ' => $ repository [1 ],
229
+ 'branch-name ' => $ options ['branch-name ' ],
230
+ 'halt-before-commit ' => $ options ['halt-before-commit ' ],
231
+ ]);
232
+ }
233
+ }
234
+ if ($ batchCommand === 'merge ' ) {
235
+ foreach ($ repositories as $ repository ) {
236
+ /** @noinspection DisconnectedForeachInstructionInspection */
237
+ chdir ($ workingDirectory ); // reset working directory
238
+ $ this ->merge ([
239
+ 'repository-url ' => $ repository [0 ],
240
+ 'working-directory ' => $ options ['working-directory ' ],
241
+ 'source ' => $ options ['source ' ],
242
+ 'target ' => $ repository [1 ],
243
+ ]);
244
+ }
229
245
}
230
246
231
247
return 0 ;
0 commit comments