git-remote-mediawiki: turn double-negated expressions into simple expressions
[gitweb.git] / contrib / mw-to-git / git-remote-mediawiki.perl
index 26389b539215a5ba464f4830ba7de15b4b9228e4..68df6e4a7006cf16ec2bee1f69d2ef76dbc23099 100755 (executable)
        if (defined($cmd[0])) {
                # Line not blank
                if ($cmd[0] eq "capabilities") {
-                       die("Too many arguments for capabilities\n") unless (!defined($cmd[1]));
+                       die("Too many arguments for capabilities\n") if (defined($cmd[1]));
                        mw_capabilities();
                } elsif ($cmd[0] eq "list") {
-                       die("Too many arguments for list\n") unless (!defined($cmd[2]));
+                       die("Too many arguments for list\n") if (defined($cmd[2]));
                        mw_list($cmd[1]);
                } elsif ($cmd[0] eq "import") {
-                       die("Invalid arguments for import\n") unless ($cmd[1] ne "" && !defined($cmd[2]));
+                       die("Invalid arguments for import\n") if ($cmd[1] eq "" || defined($cmd[2]));
                        mw_import($cmd[1]);
                } elsif ($cmd[0] eq "option") {
-                       die("Too many arguments for option\n") unless ($cmd[1] ne "" && $cmd[2] ne "" && !defined($cmd[3]));
+                       die("Too many arguments for option\n") if ($cmd[1] eq "" || $cmd[2] eq "" || defined($cmd[3]));
                        mw_option($cmd[1],$cmd[2]);
                } elsif ($cmd[0] eq "push") {
                        mw_push($cmd[1]);
@@ -454,14 +454,14 @@ sub get_mw_mediafile_for_page_revision {
 }
 
 sub download_mw_mediafile {
-       my $url = shift;
+       my $download_url = shift;
 
-       my $response = $mediawiki->{ua}->get($url);
+       my $response = $mediawiki->{ua}->get($download_url);
        if ($response->code == 200) {
                return $response->decoded_content;
        } else {
                print STDERR "Error downloading mediafile from :\n";
-               print STDERR "URL: $url\n";
+               print STDERR "URL: $download_url\n";
                print STDERR "Server response: " . $response->code . " " . $response->message . "\n";
                exit 1;
        }