remote-mediawiki: show known namespace choices on failure

If we fail to find a requested namespace, we should tell the user which ones we know about, since those were already fetched. This allows users to fetch all namespaces by specifying a dummy namespace, failing, then copying the list of namespaces in the config. Eventually, we should have a flag that allows fetching all namespaces automatically. Reviewed-by: Antoine Beaupré <anarcat@debian.org> Signed-off-by: Antoine Beaupré <anarcat@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Antoine Beaupré committed Nov 7, 2017 at 11:06 UTC 09eebbadca58dbf8e415678eeef8de54c0be6534
1 file changed +2 -1
contrib/mw-to-git/git-remote-mediawiki.perl
+2 -1
@@ -1334,7 +1334,8 @@ sub get_mw_namespace_id {
1334 my $id;
1335
1336 if (!defined $ns) {
1337 - print {*STDERR} "No such namespace ${name} on MediaWiki.\n";
1337 + my @namespaces = map { s/ /_/g; $_; } sort keys %namespace_id;
1338 + print {*STDERR} "No such namespace ${name} on MediaWiki, known namespaces: @namespaces\n";
1339 $ns = {is_namespace => 0};
1340 $namespace_id{$name} = $ns;
1341 }