Re: [PATCH v2 22/22] git-remote-mediawiki: Clearly rewrite double dereference

2013-06-07 Thread Eric Sunshine
On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte
 wrote:
> @$var structures are re-written in the following way: @{$var}
> It makes them more readable.
>
> Signed-off-by: Célestin Matte 
> Signed-off-by: Matthieu Moy 
> ---
>  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 be860c8..a13c33f 100755
> --- a/contrib/mw-to-git/git-remote-mediawiki.perl
> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl
> @@ -234,7 +234,7 @@ sub get_mw_tracked_pages {
>  sub get_mw_page_list {
> my $page_list = shift;
> my $pages = shift;
> -   my @some_pages = @$page_list;
> +   my @some_pages = @{$page_list};
> while (@some_pages) {
> my $last_page = $SLICE_SIZE;
> if ($#some_pages < $last_page) {
> @@ -736,7 +736,7 @@ sub import_file_revision {
>
> print {*STDOUT} "commit refs/mediawiki/${remotename}/master\n";
> print {*STDOUT} "mark :${n}\n";
> -   print {*STDOUT} "committer ${author} <${author}\@${wiki_name}> " . 
> $date->epoch . " +\n";
> +   print {*STDOUT} "committer ${author} <${author}\@{${wiki_name}}> " . 
> $date->epoch . " +\n";

In this case, \@ is a literal '@' in the string, so it is not a @$var
reference, thus this change is incorrect.

> literal_data($comment);
>
> # If it's not a clone, we need to know where to start from
> @@ -762,7 +762,7 @@ sub import_file_revision {
> print {*STDOUT} "reset refs/notes/${remotename}/mediawiki\n";
> }
> print {*STDOUT} "commit refs/notes/${remotename}/mediawiki\n";
> -   print {*STDOUT} "committer ${author} <${author}\@${wiki_name}> " . 
> $date->epoch . " +\n";
> +   print {*STDOUT} "committer ${author} <${author}\@{${wiki_name}}> " . 
> $date->epoch . " +\n";

Ditto: \@ is a literal '@' in the string.

> literal_data('Note added by git-mediawiki during import');
> if (!$full_import && $n == 1) {
> print {*STDOUT} "from refs/notes/${remotename}/mediawiki^0\n";
> @@ -884,7 +884,7 @@ sub mw_import_revids {
> my $n_actual = 0;
> my $last_timestamp = 0; # Placeholer in case $rev->timestamp is 
> undefined
>
> -   foreach my $pagerevid (@$revision_ids) {
> +   foreach my $pagerevid (@{$revision_ids}) {
> # Count page even if we skip it, since we display
> # $n/$total and $total includes skipped pages.
> $n++;
> @@ -919,7 +919,7 @@ sub mw_import_revids {
> my $page_title = $result_page->{title};
>
> if (!exists($pages->{$page_title})) {
> -   print {*STDERR} "${n}/", scalar(@$revision_ids),
> +   print {*STDERR} "${n}/", scalar(@{$revision_ids}),
> ": Skipping revision #$rev->{revid} of 
> ${page_title}\n";
> next;
> }
> @@ -952,7 +952,7 @@ sub mw_import_revids {
> # If this is a revision of the media page for new version
> # of a file do one common commit for both file and media page.
> # Else do commit only for that page.
> -   print {*STDERR} "${n}/", scalar(@$revision_ids), ": Revision 
> #$rev->{revid} of $commit{title}\n";
> +   print {*STDERR} "${n}/", scalar(@{$revision_ids}), ": 
> Revision #$rev->{revid} of $commit{title}\n";
> import_file_revision(\%commit, ($fetch_from == 1), $n_actual, 
> \%mediafile);
> }
>
> --
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 22/22] git-remote-mediawiki: Clearly rewrite double dereference

2013-06-07 Thread Célestin Matte
@$var structures are re-written in the following way: @{$var}
It makes them more readable.

Signed-off-by: Célestin Matte 
Signed-off-by: Matthieu Moy 
---
 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 be860c8..a13c33f 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -234,7 +234,7 @@ sub get_mw_tracked_pages {
 sub get_mw_page_list {
my $page_list = shift;
my $pages = shift;
-   my @some_pages = @$page_list;
+   my @some_pages = @{$page_list};
while (@some_pages) {
my $last_page = $SLICE_SIZE;
if ($#some_pages < $last_page) {
@@ -736,7 +736,7 @@ sub import_file_revision {
 
print {*STDOUT} "commit refs/mediawiki/${remotename}/master\n";
print {*STDOUT} "mark :${n}\n";
-   print {*STDOUT} "committer ${author} <${author}\@${wiki_name}> " . 
$date->epoch . " +\n";
+   print {*STDOUT} "committer ${author} <${author}\@{${wiki_name}}> " . 
$date->epoch . " +\n";
literal_data($comment);
 
# If it's not a clone, we need to know where to start from
@@ -762,7 +762,7 @@ sub import_file_revision {
print {*STDOUT} "reset refs/notes/${remotename}/mediawiki\n";
}
print {*STDOUT} "commit refs/notes/${remotename}/mediawiki\n";
-   print {*STDOUT} "committer ${author} <${author}\@${wiki_name}> " . 
$date->epoch . " +\n";
+   print {*STDOUT} "committer ${author} <${author}\@{${wiki_name}}> " . 
$date->epoch . " +\n";
literal_data('Note added by git-mediawiki during import');
if (!$full_import && $n == 1) {
print {*STDOUT} "from refs/notes/${remotename}/mediawiki^0\n";
@@ -884,7 +884,7 @@ sub mw_import_revids {
my $n_actual = 0;
my $last_timestamp = 0; # Placeholer in case $rev->timestamp is 
undefined
 
-   foreach my $pagerevid (@$revision_ids) {
+   foreach my $pagerevid (@{$revision_ids}) {
# Count page even if we skip it, since we display
# $n/$total and $total includes skipped pages.
$n++;
@@ -919,7 +919,7 @@ sub mw_import_revids {
my $page_title = $result_page->{title};
 
if (!exists($pages->{$page_title})) {
-   print {*STDERR} "${n}/", scalar(@$revision_ids),
+   print {*STDERR} "${n}/", scalar(@{$revision_ids}),
": Skipping revision #$rev->{revid} of 
${page_title}\n";
next;
}
@@ -952,7 +952,7 @@ sub mw_import_revids {
# If this is a revision of the media page for new version
# of a file do one common commit for both file and media page.
# Else do commit only for that page.
-   print {*STDERR} "${n}/", scalar(@$revision_ids), ": Revision 
#$rev->{revid} of $commit{title}\n";
+   print {*STDERR} "${n}/", scalar(@{$revision_ids}), ": Revision 
#$rev->{revid} of $commit{title}\n";
import_file_revision(\%commit, ($fetch_from == 1), $n_actual, 
\%mediafile);
}
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html