From 28943f41d8dcff6181f9c2c7a591c3d0a809e5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 28 Jun 2023 17:57:38 +0200 Subject: [PATCH] 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 --- new.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/new.php b/new.php index 3a9444f..5917628 100644 --- a/new.php +++ b/new.php @@ -162,6 +162,7 @@ function set_progress( float $pc, string $label ) { } else { $patches = []; } +$initialPatchCount = count( $patches ); set_progress( 0, 'Checking language code...' ); @@ -178,7 +179,7 @@ function set_progress( float $pc, string $label ) { $usedRepos = []; // Iterate by reference, so that we can modify the $patches array to add new entries -foreach ( $patches as &$patch ) { +foreach ( $patches as $i => &$patch ) { preg_match( '/^(I[0-9a-f]+|(?[0-9]+)(,(?

[0-9]+))?)$/', $patch, $matches ); if ( !$matches ) { $patch = htmlentities( $patch ); @@ -226,8 +227,15 @@ function set_progress( float $pc, string $label ) { $repos = get_repo_data(); if ( !isset( $repos[ $repo ] ) ) { - $repo = htmlentities( $repo ); - abandon( "Repository $repo not supported" ); + $repoHtml = htmlentities( $repo ); + if ( $i < $initialPatchCount ) { + // Patch requested by the user, so show an error + abandon( "Repository $repoHtml not supported" ); + } else { + // Patch added from 'Depends-On', so we can probably ignore it + warn( "One of your patches depends on a patch from the $repoHtml repository, which is not supported." ); + continue; + } } $path = $repos[ $repo ]; $usedRepos[] = $repo;