aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2012-07-06 12:03:15 +0200
committerJunio C Hamano <gitster@pobox.com>2012-07-06 12:20:46 -0700
commitff0bfd754d621ae267861441f7b525dff1b0ab27 (patch)
treeb8eee22ae736be2f9d64f5d98ea4f4a0efc6fa0c /contrib
parent5a29217dda0625707a46f527d17489c0bff0c2c9 (diff)
downloadgit-ff0bfd754d621ae267861441f7b525dff1b0ab27.tar.gz
git-ff0bfd754d621ae267861441f7b525dff1b0ab27.tar.xz
git-remote-mediawiki: be more defensive when requests fail
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/mw-to-git/git-remote-mediawiki8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki
index 6bf1d1ad4..ff9384e91 100755
--- a/contrib/mw-to-git/git-remote-mediawiki
+++ b/contrib/mw-to-git/git-remote-mediawiki
@@ -912,6 +912,14 @@ sub mw_import_revids {
my $result = $mediawiki->api($query);
+ if (!$result) {
+ die "Failed to retrieve modified page for revision $pagerevid";
+ }
+
+ if (!defined($result->{query}->{pages})) {
+ die "Invalid revision $pagerevid.";
+ }
+
my @result_pages = values(%{$result->{query}->{pages}});
my $result_page = $result_pages[0];
my $rev = $result_pages[0]->{revisions}->[0];