Thread (31 messages) flat view 31 messages, 3 authors, 2016-06-15

Re: [PATCH 13/18] Remove "unless" statements and replace them by negated "if" statements

From: Eric Sunshine <hidden>
Date: 2016-06-15 22:57:34

On Thu, Jun 6, 2013 at 3:34 PM, Célestin Matte
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Célestin Matte <redacted>
Signed-off-by: Matthieu Moy <redacted>
---
 contrib/mw-to-git/git-remote-mediawiki.perl |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 757a7a3..b7a7012 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -87,11 +87,11 @@ $shallow_import = ($shallow_import eq 'true');
 # - by_rev: perform one query per new revision on the remote wiki
 # - by_page: query each tracked page for new revision
 my $fetch_strategy = run_git("config --get remote.${remotename}.fetchStrategy");
-unless ($fetch_strategy) {
+if (! $fetch_strategy) {
Minor style nit: Existing code in git-remote-mediawiki.perl does not
have whitespace following '!'. This nit applies to this entire patch,
so: s/! /!/g
quoted hunk ↗ jump to hunk
        $fetch_strategy = run_git('config --get mediawiki.fetchStrategy');
 }
 chomp($fetch_strategy);
-unless ($fetch_strategy) {
+if (! $fetch_strategy) {
        $fetch_strategy = 'by_page';
 }
@@ -113,7 +113,7 @@ my %basetimestamps;
 # deterministic, this means everybody gets the same sha1 for each
 # MediaWiki revision.
 my $dumb_push = run_git("config --get --bool remote.${remotename}.dumbPush");
-unless ($dumb_push) {
+if (! $dumb_push) {
        $dumb_push = run_git('config --get --bool mediawiki.dumbPush');
 }
 chomp($dumb_push);
@@ -668,7 +668,7 @@ sub fetch_mw_revisions_for_page {
                        push(@page_revs, $page_rev_ids);
                        $revnum++;
                }
-               last unless $result->{'query-continue'};
+               last if (! $result->{'query-continue'});
                $query->{rvstartid} = $result->{'query-continue'}->{revisions}->{rvstartid};
        }
        if ($shallow_import && @page_revs) {
@@ -1240,7 +1240,7 @@ sub mw_push_revision {
                                die("Unknown error from mw_push_file()\n");
                        }
                }
-               unless ($dumb_push) {
+               if (! $dumb_push) {
                        run_git(qq(notes --ref=${remotename}/mediawiki add -f -m "mediawiki_revision: ${mw_revision}" ${sha1_commit}));
                        run_git(qq(update-ref -m "Git-MediaWiki push" refs/mediawiki/${remotename}/master ${sha1_commit} ${sha1_child}));
                }
@@ -1320,7 +1320,7 @@ sub get_mw_namespace_id {
        my $ns = $namespace_id{$name};
        my $id;

-       unless (defined $ns) {
+       if (! defined $ns) {
                print {*STDERR} "No such namespace ${name} on MediaWiki.\n";
                $ns = {is_namespace => 0};
                $namespace_id{$name} = $ns;
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help