summaryrefslogtreecommitdiff
path: root/contrib/mw-to-git/git-remote-mediawiki.perl
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2013-09-25 06:19:00 (GMT)
committerJonathan Nieder <jrnieder@gmail.com>2013-09-25 06:19:00 (GMT)
commit962393b5d9744ee124acb74d6c4cf0e162d12e9a (patch)
tree93c9e03edfbecc9793990475591d0ca89902d136 /contrib/mw-to-git/git-remote-mediawiki.perl
parentccba805681b1b3c3ce4f053f20171b04ced2037a (diff)
parent1d905f74fd2b05dcbc768acbb5426dc11fb00f6f (diff)
downloadgit-962393b5d9744ee124acb74d6c4cf0e162d12e9a.zip
git-962393b5d9744ee124acb74d6c4cf0e162d12e9a.tar.gz
git-962393b5d9744ee124acb74d6c4cf0e162d12e9a.tar.bz2
Merge branch 'maint'
* maint: git-remote-mediawiki: bugfix for pages w/ >500 revisions
Diffstat (limited to 'contrib/mw-to-git/git-remote-mediawiki.perl')
-rwxr-xr-xcontrib/mw-to-git/git-remote-mediawiki.perl14
1 files changed, 12 insertions, 2 deletions
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index c9a4805..476e0a2 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -625,6 +625,9 @@ sub fetch_mw_revisions_for_page {
rvstartid => $fetch_from,
rvlimit => 500,
pageids => $id,
+
+ # Let MediaWiki know that we support the latest API.
+ continue => '',
};
my $revnum = 0;
@@ -640,8 +643,15 @@ sub fetch_mw_revisions_for_page {
push(@page_revs, $page_rev_ids);
$revnum++;
}
- last if (!$result->{'query-continue'});
- $query->{rvstartid} = $result->{'query-continue'}->{revisions}->{rvstartid};
+
+ if ($result->{'query-continue'}) { # For legacy APIs
+ $query->{rvstartid} = $result->{'query-continue'}->{revisions}->{rvstartid};
+ } elsif ($result->{continue}) { # For newer APIs
+ $query->{rvstartid} = $result->{continue}->{rvcontinue};
+ $query->{continue} = $result->{continue}->{continue};
+ } else {
+ last;
+ }
}
if ($shallow_import && @page_revs) {
print {*STDERR} " Found 1 revision (shallow import).\n";