Re: [PATCH 3/4] remote-mediawiki: show known namespace choices on failure
From: Thomas Adam <hidden>
Date: 2017-11-04 10:57:20
On Sun, Oct 29, 2017 at 12:08:56PM -0400, Antoine Beaupré wrote:
quoted hunk ↗ jump to hunk
if we fail to find a requested namespace, we should tell the user which ones we know about, since we already do. this allows users to feetch 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é <redacted> Signed-off-by: Antoine Beaupré <redacted> --- contrib/mw-to-git/git-remote-mediawiki.perl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl index fc48846a1..07cc74bac 100755 --- a/contrib/mw-to-git/git-remote-mediawiki.perl +++ b/contrib/mw-to-git/git-remote-mediawiki.perl@@ -1334,7 +1334,9 @@ sub get_mw_namespace_id { my $id; if (!defined $ns) { - print {*STDERR} "No such namespace ${name} on MediaWiki.\n"; + my @namespaces = sort keys %namespace_id; + for (@namespaces) { s/ /_/g; }
I am sure we can improve upon the need to process @namespaces twice:
my @namespaces = map { s/ /_/g; $_; } sort keys %namespaces_id;
-- Thomas Adam