Skip to content

Commit 962393b

Browse files
committed
Merge branch 'maint'
* maint: git-remote-mediawiki: bugfix for pages w/ >500 revisions
2 parents ccba805 + 1d905f7 commit 962393b

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

contrib/mw-to-git/git-remote-mediawiki.perl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,9 @@ sub fetch_mw_revisions_for_page {
625625
rvstartid => $fetch_from,
626626
rvlimit => 500,
627627
pageids => $id,
628+
629+
# Let MediaWiki know that we support the latest API.
630+
continue => '',
628631
};
629632

630633
my $revnum = 0;
@@ -640,8 +643,15 @@ sub fetch_mw_revisions_for_page {
640643
push(@page_revs, $page_rev_ids);
641644
$revnum++;
642645
}
643-
last if (!$result->{'query-continue'});
644-
$query->{rvstartid} = $result->{'query-continue'}->{revisions}->{rvstartid};
646+
647+
if ($result->{'query-continue'}) { # For legacy APIs
648+
$query->{rvstartid} = $result->{'query-continue'}->{revisions}->{rvstartid};
649+
} elsif ($result->{continue}) { # For newer APIs
650+
$query->{rvstartid} = $result->{continue}->{rvcontinue};
651+
$query->{continue} = $result->{continue}->{continue};
652+
} else {
653+
last;
654+
}
645655
}
646656
if ($shallow_import && @page_revs) {
647657
print {*STDERR} " Found 1 revision (shallow import).\n";
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
test_description='Test the Git Mediawiki remote helper: queries w/ more than 500 results'
4+
5+
. ./test-gitmw-lib.sh
6+
. $TEST_DIRECTORY/test-lib.sh
7+
8+
test_check_precond
9+
10+
test_expect_success 'creating page w/ >500 revisions' '
11+
wiki_reset &&
12+
for i in `test_seq 501`
13+
do
14+
echo "creating revision $i" &&
15+
wiki_editpage foo "revision $i<br/>" true
16+
done
17+
'
18+
19+
test_expect_success 'cloning page w/ >500 revisions' '
20+
git clone mediawiki::'"$WIKI_URL"' mw_dir
21+
'
22+
23+
test_done

0 commit comments

Comments
 (0)