Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.

Commit 12605d5

Browse files
committed
Ignore dependencies on unknown repositories
Sometimes folks point 'Depends-On' entries to Wikimedia config repositories. We don't support them, but these dependencies are usually not needed to test a patch on Patch demo, so ignore them instead of erroring out. Closes #573
1 parent 839633b commit 12605d5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

new.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ function set_progress( float $pc, string $label ) {
162162
} else {
163163
$patches = [];
164164
}
165+
$initialPatchCount = count( $patches );
165166

166167
set_progress( 0, 'Checking language code...' );
167168

@@ -178,7 +179,7 @@ function set_progress( float $pc, string $label ) {
178179
$usedRepos = [];
179180

180181
// Iterate by reference, so that we can modify the $patches array to add new entries
181-
foreach ( $patches as &$patch ) {
182+
foreach ( $patches as $i => &$patch ) {
182183
preg_match( '/^(I[0-9a-f]+|(?<r>[0-9]+)(,(?<p>[0-9]+))?)$/', $patch, $matches );
183184
if ( !$matches ) {
184185
$patch = htmlentities( $patch );
@@ -226,8 +227,15 @@ function set_progress( float $pc, string $label ) {
226227

227228
$repos = get_repo_data();
228229
if ( !isset( $repos[ $repo ] ) ) {
229-
$repo = htmlentities( $repo );
230-
abandon( "Repository <em>$repo</em> not supported" );
230+
$repoHtml = htmlentities( $repo );
231+
if ( $i < $initialPatchCount ) {
232+
// Patch requested by the user, so show an error
233+
abandon( "Repository <em>$repoHtml</em> not supported" );
234+
} else {
235+
// Patch added from 'Depends-On', so we can probably ignore it
236+
warn( "One of your patches depends on a patch from the <em>$repoHtml</em> repository, which is not supported." );
237+
continue;
238+
}
231239
}
232240
$path = $repos[ $repo ];
233241
$usedRepos[] = $repo;

0 commit comments

Comments
 (0)