Thread (71 messages) 71 messages, 4 authors, 2017-11-07

Re: [PATCH 3/4] remote-mediawiki: show known namespace choices on failure

From: Eric Sunshine <hidden>
Date: 2017-10-29 17:34:37

On Sun, Oct 29, 2017 at 12:08 PM, Antoine Beaupré [off-list ref] wrote:
if we fail to find a requested namespace, we should tell the user
s/if/If/
which ones we know about, since we already do. this allows users to
s/this/This/

Not sure what ", since we already do" means here.
feetch all namespaces by specifying a dummy namespace, failing, then
s/feetch/fetch/
quoted hunk ↗ jump to hunk
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>
---
diff --git 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; }
+               print {*STDERR} "No such namespace ${name} on MediaWiki, known namespaces: @namespaces.\n";
Probably want to drop the terminating "." in the error message.
                $ns = {is_namespace => 0};
                $namespace_id{$name} = $ns;
        }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help