diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 9ff45fd..fa49882 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -102,6 +102,15 @@ if (!$fetch_strategy) {
$fetch_strategy = 'by_page';
}
+my $push_strategy = run_git("config --get remote.${remotename}.pushStrategy");
+if (!$push_strategy) {
+ $push_strategy = run_git('config --get mediawiki.pushStrategy');
+}
+chomp($push_strategy);
+if (!$push_strategy) {
+ $push_strategy = 'by_page';
+}
+
# Remember the timestamp corresponding to a revision id.
my %basetimestamps;
@@ -512,7 +521,7 @@ sub get_last_local_revision {
# Get the last remote revision without taking in account which pages are
# tracked or not. This function makes a single request to the wiki thus
# avoid a loop onto all tracked pages. This is useful for the fetch-by-rev
-# option.
+# and the push-by-rev options.
sub get_last_global_remote_rev {
mw_connect_maybe();
@@ -1160,8 +1169,19 @@ sub mw_push_revision {
my $local = shift;
my $remote = shift; # actually, this has to be "refs/heads/master" at this point.
my $last_local_revid = get_last_local_revision();
+ my $last_remote_revid;
print {*STDERR} ".\n"; # Finish sentence started by get_last_local_revision()
- my $last_remote_revid = get_last_remote_revision();
+ if ($push_strategy eq 'by_page') {
+ print {*STDERR} "Pushing export data by pages...\n";
+ $last_remote_revid = get_last_remote_revision();
+ } elsif ($push_strategy eq 'by_rev') {
+ print {*STDERR} "Pushing export data by revs...\n";
+ $last_remote_revid = get_last_global_remote_rev();
+ } else {
+ print {*STDERR} qq(fatal: invalid push strategy "${push_strategy}".\n);
+ print {*STDERR} "Check your configuration variables remote.${remotename}.pushStrategy and mediawiki.pushStrategy\n";
+ exit 1;
+ }
my $mw_revision = $last_remote_revid;
# Get sha1 of commit pointed by local HEAD--
1.8.3.1.522.gd761f2b.dirty