git-remote-mediawiki: change return type of get_mw_pages
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Fri, 6 Jul 2012 10:03:11 +0000 (12:03 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Jul 2012 19:20:46 +0000 (12:20 -0700)
The previous version was returning the list of pages to be fetched, but
we are going to need an efficient membership test (i.e. is the page
$title tracked), hence exposing a hash will be more convenient.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/mw-to-git/git-remote-mediawiki

index 063a978a6ec450a96a08d57b8693e76cf1f17587..4bf990bd58040f2644cf79a0301fb9e7ac41b27d 100755 (executable)
@@ -379,7 +379,7 @@ sub get_mw_pages {
                        get_all_mediafiles(\%pages);
                }
        }
-       return values(%pages);
+       return %pages;
 }
 
 # usage: $out = run_git("command args");
@@ -536,7 +536,8 @@ my %basetimestamps;
 sub get_last_remote_revision {
        mw_connect_maybe();
 
-       my @pages = get_mw_pages();
+       my %pages_hash = get_mw_pages();
+       my @pages = values(%pages_hash);
 
        my $max_rev_num = 0;
 
@@ -802,7 +803,8 @@ sub mw_import_ref {
 
        mw_connect_maybe();
 
-       my @pages = get_mw_pages();
+       my %pages_hash = get_mw_pages();
+       my @pages = values(%pages_hash);
 
        print STDERR "Searching revisions...\n";
        my $last_local = get_last_local_revision();