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>
This commit is contained in:
Antoine Beaupré 2017-11-07 11:06:57 -05:00 committed by Junio C Hamano
parent cc92338004
commit 09eebbadca

View file

@ -1334,7 +1334,8 @@ sub get_mw_namespace_id {
my $id;
if (!defined $ns) {
print {*STDERR} "No such namespace ${name} on MediaWiki.\n";
my @namespaces = map { s/ /_/g; $_; } sort keys %namespace_id;
print {*STDERR} "No such namespace ${name} on MediaWiki, known namespaces: @namespaces\n";
$ns = {is_namespace => 0};
$namespace_id{$name} = $ns;
}