{"thread":{"id":"34115","subject":"[PATCH v5 00/31] Follow perlcritic's recommandations","startedAt":"2013-06-12T15:43:17Z","lastAt":"2013-06-12T22:53:59Z","messageCount":39,"participants":["Célestin Matte","Matthieu Moy","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":5,"patchTotal":31},"messages":[{"id":"220616","messageId":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":null,"subject":"[PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:17Z","receivedAt":"2013-06-12T15:43:17Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Not many changes since v3. This version is only for fixing last typos and\napplying Junio's recommandations for [21/31], which I forgot in v4.\nAt this point, the only patch worth reviewing is [21/31].\n\nChanges with v4 : \n- fixed typos\n- Change in [21/31]: all the processing is done within the subroutine\n\nChanges with v3:\n- Remove whitespace in [18/28]\n- Typo in [09/28]\n- Better line split in [22/28]\n- A part of the file @@ -610,9 +610,9 @@ had escaped patches [22/31] and \n[23/31] for some reason. This is fixed.\n- patch [29/31] and [30/31] are new: they add a .perlcriticrc file to ignore\nsome rules and add a rule in the Makefile for perlcritic\n- patch [31/31] is also a new one, which intends to make some error messages \nmore precise. It comes from an advice from es in the reviewing of v1, that I \nhad forgotten to add in earlier versions. It is not related to perlcritic, but I\nhope it can be included into this series of patches anyway.\n\nChanges with v2:\n- Remove patch [02/22] about using the Readonly module\n- Split commit [07/22] into 5 different ones\n- Split commit [14/22] into 2 different ones\n- Patch [17/22] was *not* split: tell me if it is necessary\n- Remove wrong change in patch [22/22]\n\nChanges with v1:\n- split first commit into 6 different commits\n- remove commit [17/18] about moving open() call\n- took every other comment into account\n\nCélestin Matte (31):\n  git-remote-mediawiki: Make a regexp clearer\n  git-remote-mediawiki: Move \"use warnings;\" before any instruction\n  git-remote-mediawiki: Replace :utf8 by :encoding(UTF-8)\n  git-remote-mediawiki: Always end a subroutine with a return\n  git-remote-mediawiki: Move a variable declaration at the top of the\n    code\n  git-remote-mediawiki: Change syntax of map calls\n  git-remote-mediawiki: Rewrite unclear line of instructions\n  git-remote-mediawiki: Remove useless regexp modifier (m)\n  git-remote-mediawiki: Change the behaviour of a split\n  git-remote-mediawiki: Change separator of some regexps\n  git-remote-mediawiki: Change style in a regexp\n  git-remote-mediawiki: Change style in a regexp\n  git-remote-mediawiki: Add newline in the end of die() error messages\n  git-remote-mediawiki: Change the name of a variable\n  git-remote-mediawiki: Turn double-negated expressions into simple\n    expressions\n  git-remote-mediawiki: Remove unused variable $entry\n  git-remote-mediawiki: Rename a variable ($last) which has the name of\n    a keyword\n  git-remote-mediawiki: Assign a variable as undef and make proper\n    indentation\n  git-remote-mediawiki: Check return value of open\n  git-remote-mediawiki: remove import of unused open2\n  git-remote-mediawiki: Put long code into a subroutine\n  git-remote-mediawiki: Modify strings for a better coding-style\n  git-remote-mediawiki: Brace file handles for print for more clarity\n  git-remote-mediawiki: Replace \"unless\" statements with negated \"if\"\n    statements\n  git-remote-mediawiki: Don't use quotes for empty strings\n  git-remote-mediawiki: Put non-trivial numeric values in constants.\n  git-remote-mediawiki: Fix a typo (\"mediwiki\" instead of \"mediawiki\")\n  git-remote-mediawiki: Clearly rewrite double dereference\n  git-remote-mediawiki: Add a .perlcriticrc file\n  git-remote-mediawiki: add a perlcritic rule in Makefile\n  git-remote-mediawiki: Make error message more precise\n\n contrib/mw-to-git/.perlcriticrc             |  28 ++\n contrib/mw-to-git/Makefile                  |   5 +-\n contrib/mw-to-git/git-remote-mediawiki.perl | 549 +++++++++++++++-------------\n 3 files changed, 328 insertions(+), 254 deletions(-)\n create mode 100644 contrib/mw-to-git/.perlcriticrc\n\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220642","messageId":"1371051828-12866-2-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 01/31] git-remote-mediawiki: Make a regexp clearer","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:18Z","receivedAt":"2013-06-12T15:43:18Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Perl's split function takes a regex pattern argument. You can also\nfeed it an expression, which is then compiled into a regex at runtime.\nIt therefore works to pass your pattern via single quotes, but it is\nmuch less obvious to a reader that the argument is meant to be a\nregex, not a static string. Using the traditional slash-delimiters\nmakes this easier to read.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 410eae9..a7bb397 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1170,7 +1170,7 @@ sub mw_push_revision {\n \t\t# history (linearized with --first-parent)\n \t\tprint STDERR \"Warning: no common ancestor, pushing complete history\\n\";\n \t\tmy $history = run_git(\"rev-list --first-parent --children $local\");\n-\t\tmy @history = split('\\n', $history);\n+\t\tmy @history = split(/\\n/, $history);\n \t\t@history = @history[1..$#history];\n \t\tforeach my $line (reverse @history) {\n \t\t\tmy @commit_info_split = split(/ |\\n/, $line);\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220643","messageId":"1371051828-12866-3-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 02/31] git-remote-mediawiki: Move \"use warnings;\" before any instruction","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:19Z","receivedAt":"2013-06-12T15:43:19Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex a7bb397..863ecc9 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -15,6 +15,7 @@ use strict;\n use MediaWiki::API;\n use Git;\n use DateTime::Format::ISO8601;\n+use warnings;\n \n # By default, use UTF-8 to communicate with Git and the user\n binmode STDERR, \":utf8\";\n@@ -23,8 +24,6 @@ binmode STDOUT, \":utf8\";\n use URI::Escape;\n use IPC::Open2;\n \n-use warnings;\n-\n # Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced\n use constant SLASH_REPLACEMENT => \"%2F\";\n \n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220633","messageId":"1371051828-12866-4-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 03/31] git-remote-mediawiki: Replace :utf8 by :encoding(UTF-8)","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:20Z","receivedAt":"2013-06-12T15:43:20Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Follow perlcritic's InputOutput::RequireEncodingWithUTF8Layer policy\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 863ecc9..5e198e0 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -18,8 +18,8 @@ use DateTime::Format::ISO8601;\n use warnings;\n \n # By default, use UTF-8 to communicate with Git and the user\n-binmode STDERR, \":utf8\";\n-binmode STDOUT, \":utf8\";\n+binmode STDERR, \":encoding(UTF-8)\";\n+binmode STDOUT, \":encoding(UTF-8)\";\n \n use URI::Escape;\n use IPC::Open2;\n@@ -587,7 +587,7 @@ sub literal_data_raw {\n \tutf8::downgrade($content);\n \tbinmode STDOUT, \":raw\";\n \tprint STDOUT \"data \", bytes::length($content), \"\\n\", $content;\n-\tbinmode STDOUT, \":utf8\";\n+\tbinmode STDOUT, \":encoding(UTF-8)\";\n }\n \n sub mw_capabilities {\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220636","messageId":"1371051828-12866-5-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 04/31] git-remote-mediawiki: Always end a subroutine with a return","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:21Z","receivedAt":"2013-06-12T15:43:21Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Follow Subroutines::RequireFinalReturn\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 18 ++++++++++++++++++\n 1 file changed, 18 insertions(+)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 5e198e0..f19b276 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -197,12 +197,14 @@ sub mw_connect_maybe {\n \t\t\texit 1;\n \t\t}\n \t}\n+\treturn;\n }\n \n ## Functions for listing pages on the remote wiki\n sub get_mw_tracked_pages {\n \tmy $pages = shift;\n \tget_mw_page_list(\\@tracked_pages, $pages);\n+\treturn;\n }\n \n sub get_mw_page_list {\n@@ -218,6 +220,7 @@ sub get_mw_page_list {\n \t\tget_mw_first_pages(\\@slice, $pages);\n \t\t@some_pages = @some_pages[51..$#some_pages];\n \t}\n+\treturn;\n }\n \n sub get_mw_tracked_categories {\n@@ -240,6 +243,7 @@ sub get_mw_tracked_categories {\n \t\t\t$pages->{$page->{title}} = $page;\n \t\t}\n \t}\n+\treturn;\n }\n \n sub get_mw_all_pages {\n@@ -259,6 +263,7 @@ sub get_mw_all_pages {\n \tforeach my $page (@{$mw_pages}) {\n \t\t$pages->{$page->{title}} = $page;\n \t}\n+\treturn;\n }\n \n # queries the wiki for a set of pages. Meant to be used within a loop\n@@ -289,6 +294,7 @@ sub get_mw_first_pages {\n \t\t\t$pages->{$page->{title}} = $page;\n \t\t}\n \t}\n+\treturn;\n }\n \n # Get the list of pages to be fetched according to configuration.\n@@ -357,6 +363,7 @@ sub get_all_mediafiles {\n \tforeach my $page (@{$mw_pages}) {\n \t\t$pages->{$page->{title}} = $page;\n \t}\n+\treturn;\n }\n \n sub get_linked_mediafiles {\n@@ -403,6 +410,7 @@ sub get_linked_mediafiles {\n \n \t\t@titles = @titles[($batch+1)..$#titles];\n \t}\n+\treturn;\n }\n \n sub get_mw_mediafile_for_page_revision {\n@@ -578,6 +586,7 @@ sub mediawiki_smudge_filename {\n sub literal_data {\n \tmy ($content) = @_;\n \tprint STDOUT \"data \", bytes::length($content), \"\\n\", $content;\n+\treturn;\n }\n \n sub literal_data_raw {\n@@ -588,6 +597,7 @@ sub literal_data_raw {\n \tbinmode STDOUT, \":raw\";\n \tprint STDOUT \"data \", bytes::length($content), \"\\n\", $content;\n \tbinmode STDOUT, \":encoding(UTF-8)\";\n+\treturn;\n }\n \n sub mw_capabilities {\n@@ -599,6 +609,7 @@ sub mw_capabilities {\n \tprint STDOUT \"list\\n\";\n \tprint STDOUT \"push\\n\";\n \tprint STDOUT \"\\n\";\n+\treturn;\n }\n \n sub mw_list {\n@@ -607,11 +618,13 @@ sub mw_list {\n \tprint STDOUT \"? refs/heads/master\\n\";\n \tprint STDOUT \"\\@refs/heads/master HEAD\\n\";\n \tprint STDOUT \"\\n\";\n+\treturn;\n }\n \n sub mw_option {\n \tprint STDERR \"remote-helper command 'option $_[0]' not yet implemented\\n\";\n \tprint STDOUT \"unsupported\\n\";\n+\treturn;\n }\n \n sub fetch_mw_revisions_for_page {\n@@ -733,6 +746,7 @@ sub import_file_revision {\n \tprint STDOUT \"N inline :$n\\n\";\n \tliteral_data(\"mediawiki_revision: \" . $commit{mw_revision});\n \tprint STDOUT \"\\n\\n\";\n+\treturn;\n }\n \n # parse a sequence of\n@@ -753,6 +767,7 @@ sub get_more_refs {\n \t\t\tdie(\"Invalid command in a '$cmd' batch: \". $_);\n \t\t}\n \t}\n+\treturn;\n }\n \n sub mw_import {\n@@ -762,6 +777,7 @@ sub mw_import {\n \t\tmw_import_ref($ref);\n \t}\n \tprint STDOUT \"done\\n\";\n+\treturn;\n }\n \n sub mw_import_ref {\n@@ -805,6 +821,7 @@ sub mw_import_ref {\n \t\t# thrown saying that HEAD is referring to unknown object 0000000000000000000\n \t\t# and the clone fails.\n \t}\n+\treturn;\n }\n \n sub mw_import_ref_by_pages {\n@@ -1111,6 +1128,7 @@ sub mw_push {\n \t\tprint STDERR \"  git pull --rebase\\n\";\n \t\tprint STDERR \"\\n\";\n \t}\n+\treturn;\n }\n \n sub mw_push_revision {\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220624","messageId":"1371051828-12866-6-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 05/31] git-remote-mediawiki: Move a variable declaration at the top of the code","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:22Z","receivedAt":"2013-06-12T15:43:22Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"%basetimestamps declaration was lost in the middle of subroutines\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex f19b276..fe1343d 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -95,6 +95,9 @@ unless ($fetch_strategy) {\n \t$fetch_strategy = \"by_page\";\n }\n \n+# Remember the timestamp corresponding to a revision id.\n+my %basetimestamps;\n+\n # Dumb push: don't update notes and mediawiki ref to reflect the last push.\n #\n # Configurable with mediawiki.dumbPush, or per-remote with\n@@ -480,9 +483,6 @@ sub get_last_local_revision {\n \treturn $lastrevision_number;\n }\n \n-# Remember the timestamp corresponding to a revision id.\n-my %basetimestamps;\n-\n # Get the last remote revision without taking in account which pages are\n # tracked or not. This function makes a single request to the wiki thus\n # avoid a loop onto all tracked pages. This is useful for the fetch-by-rev\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220645","messageId":"1371051828-12866-7-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 06/31] git-remote-mediawiki: Change syntax of map calls","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:23Z","receivedAt":"2013-06-12T15:43:23Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Put first parameter of map inside a block, for better readability.\nFollow BuiltinFunctions::RequireBlockMap\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 14 ++++++++------\n 1 file changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex fe1343d..431e063 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -371,7 +371,7 @@ sub get_all_mediafiles {\n \n sub get_linked_mediafiles {\n \tmy $pages = shift;\n-\tmy @titles = map $_->{title}, values(%{$pages});\n+\tmy @titles = map { $_->{title} } values(%{$pages});\n \n \t# The query is split in small batches because of the MW API limit of\n \t# the number of links to be returned (500 links max).\n@@ -399,11 +399,13 @@ sub get_linked_mediafiles {\n \t\twhile (my ($id, $page) = each(%{$result->{query}->{pages}})) {\n \t\t\tmy @media_titles;\n \t\t\tif (defined($page->{links})) {\n-\t\t\t\tmy @link_titles = map $_->{title}, @{$page->{links}};\n+\t\t\t\tmy @link_titles\n+\t\t\t\t    = map { $_->{title} } @{$page->{links}};\n \t\t\t\tpush(@media_titles, @link_titles);\n \t\t\t}\n \t\t\tif (defined($page->{images})) {\n-\t\t\t\tmy @image_titles = map $_->{title}, @{$page->{images}};\n+\t\t\t\tmy @image_titles\n+\t\t\t\t    = map { $_->{title} } @{$page->{images}};\n \t\t\t\tpush(@media_titles, @image_titles);\n \t\t\t}\n \t\t\tif (@media_titles) {\n@@ -833,7 +835,7 @@ sub mw_import_ref_by_pages {\n \tmy ($n, @revisions) = fetch_mw_revisions(\\@pages, $fetch_from);\n \n \t@revisions = sort {$a->{revid} <=> $b->{revid}} @revisions;\n-\tmy @revision_ids = map $_->{revid}, @revisions;\n+\tmy @revision_ids = map { $_->{revid} } @revisions;\n \n \treturn mw_import_revids($fetch_from, \\@revision_ids, \\%pages_hash);\n }\n@@ -1246,8 +1248,8 @@ sub get_allowed_file_extensions {\n \t\tsiprop => 'fileextensions'\n \t\t};\n \tmy $result = $mediawiki->api($query);\n-\tmy @file_extensions= map $_->{ext},@{$result->{query}->{fileextensions}};\n-\tmy %hashFile = map {$_ => 1}@file_extensions;\n+\tmy @file_extensions = map { $_->{ext}} @{$result->{query}->{fileextensions}};\n+\tmy %hashFile = map { $_ => 1 } @file_extensions;\n \n \treturn %hashFile;\n }\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220625","messageId":"1371051828-12866-8-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 07/31] git-remote-mediawiki: Rewrite unclear line of instructions","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:24Z","receivedAt":"2013-06-12T15:43:24Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Subroutines' parameters should be assigned to variable before doing anything\nelse\nBesides, existing instruction affected a variable inside a \"if\", which break\nGit's coding style\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 431e063..2db6467 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1333,7 +1333,8 @@ sub get_mw_namespace_id {\n }\n \n sub get_mw_namespace_id_for_page {\n-\tif (my ($namespace) = $_[0] =~ /^([^:]*):/) {\n+\tmy $namespace = shift;\n+\tif ($namespace =~ /^([^:]*):/) {\n \t\treturn get_mw_namespace_id($namespace);\n \t} else {\n \t\treturn;\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220646","messageId":"1371051828-12866-9-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 08/31] git-remote-mediawiki: Remove useless regexp modifier (m)","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:25Z","receivedAt":"2013-06-12T15:43:25Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"m// and // is used randomly. It is better to use the m modifier only when\nneeded, e.g., when the regexp uses another separator than //.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 2db6467..7ce640f 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -761,7 +761,7 @@ sub get_more_refs {\n \tmy @refs;\n \twhile (1) {\n \t\tmy $line = <STDIN>;\n-\t\tif ($line =~ m/^$cmd (.*)$/) {\n+\t\tif ($line =~ /^$cmd (.*)$/) {\n \t\t\tpush(@refs, $1);\n \t\t} elsif ($line eq \"\\n\") {\n \t\t\treturn @refs;\n@@ -1167,11 +1167,11 @@ sub mw_push_revision {\n \t\tmy @local_ancestry = split(/\\n/, run_git(\"rev-list --boundary --parents $local ^$parsed_sha1\"));\n \t\tmy %local_ancestry;\n \t\tforeach my $line (@local_ancestry) {\n-\t\t\tif (my ($child, $parents) = $line =~ m/^-?([a-f0-9]+) ([a-f0-9 ]+)/) {\n+\t\t\tif (my ($child, $parents) = $line =~ /^-?([a-f0-9]+) ([a-f0-9 ]+)/) {\n \t\t\t\tforeach my $parent (split(' ', $parents)) {\n \t\t\t\t\t$local_ancestry{$parent} = $child;\n \t\t\t\t}\n-\t\t\t} elsif (!$line =~ m/^([a-f0-9]+)/) {\n+\t\t\t} elsif (!$line =~ /^([a-f0-9]+)/) {\n \t\t\t\tdie \"Unexpected output from git rev-list: $line\";\n \t\t\t}\n \t\t}\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220629","messageId":"1371051828-12866-10-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 09/31] git-remote-mediawiki: Change the behaviour of a split","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:26Z","receivedAt":"2013-06-12T15:43:26Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"A \"split ' '\" is turned into a \"split / /\", which changes its behaviour: the\nold method matched a run of whitespaces (/\\s*/), while the new one will match a\nsingle space, which is what we want here. Indeed, in other contexts,\nchanging split(' ') to split(/ /) could potentially be a regression, however,\nhere, when parsing the output of \"rev-list --parents\", whose output SHA-1's are\neach separated by a single space, splitting on a single space is perfectly\ncorrect.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 7ce640f..7537305 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1168,7 +1168,7 @@ sub mw_push_revision {\n \t\tmy %local_ancestry;\n \t\tforeach my $line (@local_ancestry) {\n \t\t\tif (my ($child, $parents) = $line =~ /^-?([a-f0-9]+) ([a-f0-9 ]+)/) {\n-\t\t\t\tforeach my $parent (split(' ', $parents)) {\n+\t\t\t\tforeach my $parent (split(/ /, $parents)) {\n \t\t\t\t\t$local_ancestry{$parent} = $child;\n \t\t\t\t}\n \t\t\t} elsif (!$line =~ /^([a-f0-9]+)/) {\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220647","messageId":"1371051828-12866-11-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 10/31] git-remote-mediawiki: Change separator of some regexps","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:27Z","receivedAt":"2013-06-12T15:43:27Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Use {}{} instead of /// when slashes are used inside the regexp so as not to\nescape it.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 7537305..b01d402 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -120,7 +120,7 @@ chomp($dumb_push);\n $dumb_push = ($dumb_push eq \"true\");\n \n my $wiki_name = $url;\n-$wiki_name =~ s/[^\\/]*:\\/\\///;\n+$wiki_name =~ s{[^/]*://}{};\n # If URL is like http://user:password@example.com/, we clearly don't\n # want the password in $wiki_name. While we're there, also remove user\n # and '@' sign, to avoid author like MWUser@HTTPUser@host.com\n@@ -564,7 +564,7 @@ sub mediawiki_smudge {\n \n sub mediawiki_clean_filename {\n \tmy $filename = shift;\n-\t$filename =~ s/@{[SLASH_REPLACEMENT]}/\\//g;\n+\t$filename =~ s{@{[SLASH_REPLACEMENT]}}{/}g;\n \t# [, ], |, {, and } are forbidden by MediaWiki, even URL-encoded.\n \t# Do a variant of URL-encoding, i.e. looks like URL-encoding,\n \t# but with _ added to prevent MediaWiki from thinking this is\n@@ -578,7 +578,7 @@ sub mediawiki_clean_filename {\n \n sub mediawiki_smudge_filename {\n \tmy $filename = shift;\n-\t$filename =~ s/\\//@{[SLASH_REPLACEMENT]}/g;\n+\t$filename =~ s{/}{@{[SLASH_REPLACEMENT]}}g;\n \t$filename =~ s/ /_/g;\n \t# Decode forbidden characters encoded in mediawiki_clean_filename\n \t$filename =~ s/_%_([0-9a-fA-F][0-9a-fA-F])/sprintf(\"%c\", hex($1))/ge;\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220644","messageId":"1371051828-12866-12-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 11/31] git-remote-mediawiki: Change style in a regexp","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:28Z","receivedAt":"2013-06-12T15:43:28Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"In this regexp, ' |\\n' is used, whereas its equivalent '[ \\n]', which is\nclearer, is used elsewhere. Make the style coherent.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex b01d402..267c164 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1192,7 +1192,7 @@ sub mw_push_revision {\n \t\tmy @history = split(/\\n/, $history);\n \t\t@history = @history[1..$#history];\n \t\tforeach my $line (reverse @history) {\n-\t\t\tmy @commit_info_split = split(/ |\\n/, $line);\n+\t\t\tmy @commit_info_split = split(/[ \\n]/, $line);\n \t\t\tpush(@commit_pairs, \\@commit_info_split);\n \t\t}\n \t}\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220640","messageId":"1371051828-12866-13-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 12/31] git-remote-mediawiki: Change style in a regexp","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:29Z","receivedAt":"2013-06-12T15:43:29Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Change '[\\n]' to '\\n': brackets are useless here.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 267c164..86229a1 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1271,7 +1271,7 @@ sub get_mw_namespace_id {\n \t\t# Look at configuration file, if the record for that namespace is\n \t\t# already cached. Namespaces are stored in form:\n \t\t# \"Name_of_namespace:Id_namespace\", ex.: \"File:6\".\n-\t\tmy @temp = split(/[\\n]/, run_git(\"config --get-all remote.\"\n+\t\tmy @temp = split(/\\n/, run_git(\"config --get-all remote.\"\n \t\t\t\t\t\t. $remotename .\".namespaceCache\"));\n \t\tchomp(@temp);\n \t\tforeach my $ns (@temp) {\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220639","messageId":"1371051828-12866-14-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 13/31] git-remote-mediawiki: Add newline in the end of die() error messages","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:30Z","receivedAt":"2013-06-12T15:43:30Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 26 +++++++++++++-------------\n 1 file changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 86229a1..44c5e0e 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -135,16 +135,16 @@ while (<STDIN>) {\n \tif (defined($cmd[0])) {\n \t\t# Line not blank\n \t\tif ($cmd[0] eq \"capabilities\") {\n-\t\t\tdie(\"Too many arguments for capabilities\") unless (!defined($cmd[1]));\n+\t\t\tdie(\"Too many arguments for capabilities\\n\") unless (!defined($cmd[1]));\n \t\t\tmw_capabilities();\n \t\t} elsif ($cmd[0] eq \"list\") {\n-\t\t\tdie(\"Too many arguments for list\") unless (!defined($cmd[2]));\n+\t\t\tdie(\"Too many arguments for list\\n\") unless (!defined($cmd[2]));\n \t\t\tmw_list($cmd[1]);\n \t\t} elsif ($cmd[0] eq \"import\") {\n-\t\t\tdie(\"Invalid arguments for import\") unless ($cmd[1] ne \"\" && !defined($cmd[2]));\n+\t\t\tdie(\"Invalid arguments for import\\n\") unless ($cmd[1] ne \"\" && !defined($cmd[2]));\n \t\t\tmw_import($cmd[1]);\n \t\t} elsif ($cmd[0] eq \"option\") {\n-\t\t\tdie(\"Too many arguments for option\") unless ($cmd[1] ne \"\" && $cmd[2] ne \"\" && !defined($cmd[3]));\n+\t\t\tdie(\"Too many arguments for option\\n\") unless ($cmd[1] ne \"\" && $cmd[2] ne \"\" && !defined($cmd[3]));\n \t\t\tmw_option($cmd[1],$cmd[2]);\n \t\t} elsif ($cmd[0] eq \"push\") {\n \t\t\tmw_push($cmd[1]);\n@@ -241,7 +241,7 @@ sub get_mw_tracked_categories {\n \t\t\tcmtitle => $category,\n \t\t\tcmlimit => 'max' } )\n \t\t\t|| die $mediawiki->{error}->{code} . ': '\n-\t\t\t\t. $mediawiki->{error}->{details};\n+\t\t\t\t. $mediawiki->{error}->{details} . \"\\n\";\n \t\tforeach my $page (@{$mw_pages}) {\n \t\t\t$pages->{$page->{title}} = $page;\n \t\t}\n@@ -766,7 +766,7 @@ sub get_more_refs {\n \t\t} elsif ($line eq \"\\n\") {\n \t\t\treturn @refs;\n \t\t} else {\n-\t\t\tdie(\"Invalid command in a '$cmd' batch: \". $_);\n+\t\t\tdie(\"Invalid command in a '$cmd' batch: $_\\n\");\n \t\t}\n \t}\n \treturn;\n@@ -878,7 +878,7 @@ sub mw_import_revids {\n \t\tmy $result = $mediawiki->api($query);\n \n \t\tif (!$result) {\n-\t\t\tdie \"Failed to retrieve modified page for revision $pagerevid\";\n+\t\t\tdie \"Failed to retrieve modified page for revision $pagerevid\\n\";\n \t\t}\n \n \t\tif (defined($result->{query}->{badrevids}->{$pagerevid})) {\n@@ -887,7 +887,7 @@ sub mw_import_revids {\n \t\t}\n \n \t\tif (!defined($result->{query}->{pages})) {\n-\t\t\tdie \"Invalid revision $pagerevid.\";\n+\t\t\tdie \"Invalid revision $pagerevid.\\n\";\n \t\t}\n \n \t\tmy @result_pages = values(%{$result->{query}->{pages}});\n@@ -998,7 +998,7 @@ sub mw_upload_file {\n \t\t\t}, {\n \t\t\t\tskip_encoding => 1\n \t\t\t} ) || die $mediawiki->{error}->{code} . ':'\n-\t\t\t\t . $mediawiki->{error}->{details};\n+\t\t\t\t . $mediawiki->{error}->{details} . \"\\n\";\n \t\t\tmy $last_file_page = $mediawiki->get_page({title => $path});\n \t\t\t$newrevid = $last_file_page->{revid};\n \t\t\tprint STDERR \"Pushed file: $new_sha1 - $complete_file_name.\\n\";\n@@ -1078,7 +1078,7 @@ sub mw_push_file {\n \t\t\t\t# Other errors. Shouldn't happen => just die()\n \t\t\t\tdie 'Fatal: Error ' .\n \t\t\t\t    $mediawiki->{error}->{code} .\n-\t\t\t\t    ' from mediwiki: ' . $mediawiki->{error}->{details};\n+\t\t\t\t    ' from mediwiki: ' . $mediawiki->{error}->{details} . \"\\n\";\n \t\t\t}\n \t\t}\n \t\t$newrevid = $result->{edit}->{newrevid};\n@@ -1100,7 +1100,7 @@ sub mw_push {\n \tmy $pushed;\n \tfor my $refspec (@refsspecs) {\n \t\tmy ($force, $local, $remote) = $refspec =~ /^(\\+)?([^:]*):([^:]*)$/\n-\t\t    or die(\"Invalid refspec for push. Expected <src>:<dst> or +<src>:<dst>\");\n+\t\t    or die(\"Invalid refspec for push. Expected <src>:<dst> or +<src>:<dst>\\n\");\n \t\tif ($force) {\n \t\t\tprint STDERR \"Warning: forced push not allowed on a MediaWiki.\\n\";\n \t\t}\n@@ -1172,7 +1172,7 @@ sub mw_push_revision {\n \t\t\t\t\t$local_ancestry{$parent} = $child;\n \t\t\t\t}\n \t\t\t} elsif (!$line =~ /^([a-f0-9]+)/) {\n-\t\t\t\tdie \"Unexpected output from git rev-list: $line\";\n+\t\t\t\tdie \"Unexpected output from git rev-list: $line\\n\";\n \t\t\t}\n \t\t}\n \t\twhile ($parsed_sha1 ne $HEAD_sha1) {\n@@ -1226,7 +1226,7 @@ sub mw_push_revision {\n \t\t\t\treturn error_non_fast_forward($remote);\n \t\t\t}\n \t\t\tif ($status ne \"ok\") {\n-\t\t\t\tdie(\"Unknown error from mw_push_file()\");\n+\t\t\t\tdie(\"Unknown error from mw_push_file()\\n\");\n \t\t\t}\n \t\t}\n \t\tunless ($dumb_push) {\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220641","messageId":"1371051828-12866-15-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 14/31] git-remote-mediawiki: Change the name of a variable","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:31Z","receivedAt":"2013-06-12T15:43:31Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Local variable $url has the same name as a global variable. Changing the name\nof the local variable prevents future possible misunderstanding.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 44c5e0e..63d1530 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -454,14 +454,14 @@ sub get_mw_mediafile_for_page_revision {\n }\n \n sub download_mw_mediafile {\n-\tmy $url = shift;\n+\tmy $download_url = shift;\n \n-\tmy $response = $mediawiki->{ua}->get($url);\n+\tmy $response = $mediawiki->{ua}->get($download_url);\n \tif ($response->code == 200) {\n \t\treturn $response->decoded_content;\n \t} else {\n \t\tprint STDERR \"Error downloading mediafile from :\\n\";\n-\t\tprint STDERR \"URL: $url\\n\";\n+\t\tprint STDERR \"URL: $download_url\\n\";\n \t\tprint STDERR \"Server response: \" . $response->code . \" \" . $response->message . \"\\n\";\n \t\texit 1;\n \t}\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220638","messageId":"1371051828-12866-16-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 15/31] git-remote-mediawiki: Turn double-negated expressions into simple expressions","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:32Z","receivedAt":"2013-06-12T15:43:32Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 63d1530..6024791 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -135,16 +135,16 @@ while (<STDIN>) {\n \tif (defined($cmd[0])) {\n \t\t# Line not blank\n \t\tif ($cmd[0] eq \"capabilities\") {\n-\t\t\tdie(\"Too many arguments for capabilities\\n\") unless (!defined($cmd[1]));\n+\t\t\tdie(\"Too many arguments for capabilities\\n\") if (defined($cmd[1]));\n \t\t\tmw_capabilities();\n \t\t} elsif ($cmd[0] eq \"list\") {\n-\t\t\tdie(\"Too many arguments for list\\n\") unless (!defined($cmd[2]));\n+\t\t\tdie(\"Too many arguments for list\\n\") if (defined($cmd[2]));\n \t\t\tmw_list($cmd[1]);\n \t\t} elsif ($cmd[0] eq \"import\") {\n-\t\t\tdie(\"Invalid arguments for import\\n\") unless ($cmd[1] ne \"\" && !defined($cmd[2]));\n+\t\t\tdie(\"Invalid arguments for import\\n\") if ($cmd[1] eq \"\" || defined($cmd[2]));\n \t\t\tmw_import($cmd[1]);\n \t\t} elsif ($cmd[0] eq \"option\") {\n-\t\t\tdie(\"Too many arguments for option\\n\") unless ($cmd[1] ne \"\" && $cmd[2] ne \"\" && !defined($cmd[3]));\n+\t\t\tdie(\"Too many arguments for option\\n\") if ($cmd[1] eq \"\" || $cmd[2] eq \"\" || defined($cmd[3]));\n \t\t\tmw_option($cmd[1],$cmd[2]);\n \t\t} elsif ($cmd[0] eq \"push\") {\n \t\t\tmw_push($cmd[1]);\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220637","messageId":"1371051828-12866-17-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 16/31] git-remote-mediawiki: Remove unused variable $entry","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:33Z","receivedAt":"2013-06-12T15:43:33Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 6024791..ef9e60a 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -127,7 +127,6 @@ $wiki_name =~ s{[^/]*://}{};\n $wiki_name =~ s/^.*@//;\n \n # Commands parser\n-my $entry;\n my @cmd;\n while (<STDIN>) {\n \tchomp;\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220635","messageId":"1371051828-12866-18-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 17/31] git-remote-mediawiki: Rename a variable ($last) which has the name of a keyword","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:34Z","receivedAt":"2013-06-12T15:43:34Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex ef9e60a..0610daa 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -214,11 +214,11 @@ sub get_mw_page_list {\n \tmy $pages = shift;\n \tmy @some_pages = @$page_list;\n \twhile (@some_pages) {\n-\t\tmy $last = 50;\n-\t\tif ($#some_pages < $last) {\n-\t\t\t$last = $#some_pages;\n+\t\tmy $last_page = 50;\n+\t\tif ($#some_pages < $last_page) {\n+\t\t\t$last_page = $#some_pages;\n \t\t}\n-\t\tmy @slice = @some_pages[0..$last];\n+\t\tmy @slice = @some_pages[0..$last_page];\n \t\tget_mw_first_pages(\\@slice, $pages);\n \t\t@some_pages = @some_pages[51..$#some_pages];\n \t}\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220617","messageId":"1371051828-12866-19-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 18/31] git-remote-mediawiki: Assign a variable as undef and make proper indentation","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:35Z","receivedAt":"2013-06-12T15:43:35Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Explicitly assign local variable $/ as undef and make a proper\none-instruction-by-line indentation\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 0610daa..15ad19b 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -338,7 +338,10 @@ sub run_git {\n \tmy $args = shift;\n \tmy $encoding = (shift || \"encoding(UTF-8)\");\n \topen(my $git, \"-|:$encoding\", \"git \" . $args);\n-\tmy $res = do { local $/; <$git> };\n+\tmy $res = do {\n+\t\tlocal $/ = undef;\n+\t\t<$git>\n+\t};\n \tclose($git);\n \n \treturn $res;\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220631","messageId":"1371051828-12866-20-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 19/31] git-remote-mediawiki: Check return value of open","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:36Z","receivedAt":"2013-06-12T15:43:36Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 15ad19b..d95119f 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -337,7 +337,8 @@ sub get_mw_pages {\n sub run_git {\n \tmy $args = shift;\n \tmy $encoding = (shift || \"encoding(UTF-8)\");\n-\topen(my $git, \"-|:$encoding\", \"git \" . $args);\n+\topen(my $git, \"-|:$encoding\", \"git \" . $args)\n+\t    or die \"Unable to open: $!\\n\";\n \tmy $res = do {\n \t\tlocal $/ = undef;\n \t\t<$git>\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220634","messageId":"1371051828-12866-21-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 20/31] git-remote-mediawiki: remove import of unused open2","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:37Z","receivedAt":"2013-06-12T15:43:37Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex d95119f..7acbec8 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -22,7 +22,6 @@ binmode STDERR, \":encoding(UTF-8)\";\n binmode STDOUT, \":encoding(UTF-8)\";\n \n use URI::Escape;\n-use IPC::Open2;\n \n # Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced\n use constant SLASH_REPLACEMENT => \"%2F\";\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220627","messageId":"1371051828-12866-22-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 21/31] git-remote-mediawiki: Put long code into a subroutine","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:38Z","receivedAt":"2013-06-12T15:43:38Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 56 ++++++++++++++++-------------\n 1 file changed, 32 insertions(+), 24 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 7acbec8..52817ba 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -126,32 +126,10 @@ $wiki_name =~ s{[^/]*://}{};\n $wiki_name =~ s/^.*@//;\n \n # Commands parser\n-my @cmd;\n while (<STDIN>) {\n \tchomp;\n-\t@cmd = split(/ /);\n-\tif (defined($cmd[0])) {\n-\t\t# Line not blank\n-\t\tif ($cmd[0] eq \"capabilities\") {\n-\t\t\tdie(\"Too many arguments for capabilities\\n\") if (defined($cmd[1]));\n-\t\t\tmw_capabilities();\n-\t\t} elsif ($cmd[0] eq \"list\") {\n-\t\t\tdie(\"Too many arguments for list\\n\") if (defined($cmd[2]));\n-\t\t\tmw_list($cmd[1]);\n-\t\t} elsif ($cmd[0] eq \"import\") {\n-\t\t\tdie(\"Invalid arguments for import\\n\") if ($cmd[1] eq \"\" || defined($cmd[2]));\n-\t\t\tmw_import($cmd[1]);\n-\t\t} elsif ($cmd[0] eq \"option\") {\n-\t\t\tdie(\"Too many arguments for option\\n\") if ($cmd[1] eq \"\" || $cmd[2] eq \"\" || defined($cmd[3]));\n-\t\t\tmw_option($cmd[1],$cmd[2]);\n-\t\t} elsif ($cmd[0] eq \"push\") {\n-\t\t\tmw_push($cmd[1]);\n-\t\t} else {\n-\t\t\tprint STDERR \"Unknown command. Aborting...\\n\";\n-\t\t\tlast;\n-\t\t}\n-\t} else {\n-\t\t# blank line: we should terminate\n+\n+\tif (!parse_command($_)) {\n \t\tlast;\n \t}\n \n@@ -167,6 +145,36 @@ sub exit_error_usage {\n     die \"ERROR: git-remote-mediawiki module was not called with a correct number of parameters\\n\";\n }\n \n+sub parse_command {\n+\tmy ($line) = @_;\n+\tmy @cmd = split(/ /, $line);\n+\tif (!defined @cmd) {\n+\t\treturn 0;\n+\t}\n+\tif ($cmd[0] eq \"capabilities\") {\n+\t\tdie(\"Too many arguments for capabilities\\n\")\n+\t\t    if (defined($cmd[1]));\n+\t\tmw_capabilities();\n+\t} elsif ($cmd[0] eq \"list\") {\n+\t\tdie(\"Too many arguments for list\\n\") if (defined($cmd[2]));\n+\t\tmw_list($cmd[1]);\n+\t} elsif ($cmd[0] eq \"import\") {\n+\t\tdie(\"Invalid arguments for import\\n\")\n+\t\t    if ($cmd[1] eq \"\" || defined($cmd[2]));\n+\t\tmw_import($cmd[1]);\n+\t} elsif ($cmd[0] eq \"option\") {\n+\t\tdie(\"Too many arguments for option\\n\")\n+\t\t    if ($cmd[1] eq \"\" || $cmd[2] eq \"\" || defined($cmd[3]));\n+\t\tmw_option($cmd[1],$cmd[2]);\n+\t} elsif ($cmd[0] eq \"push\") {\n+\t\tmw_push($cmd[1]);\n+\t} else {\n+\t\tprint STDERR \"Unknown command. Aborting...\\n\";\n+\t\treturn 0;\n+\t}\n+\treturn 1;\n+}\n+\n # MediaWiki API instance, created lazily.\n my $mediawiki;\n \n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220618","messageId":"1371051828-12866-23-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 22/31] git-remote-mediawiki: Modify strings for a better coding-style","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:39Z","receivedAt":"2013-06-12T15:43:39Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"- strings which don't need interpolation are single-quoted for more clarity and\nslight gain of performance\n- interpolation is preferred over concatenation in many cases, for more clarity\n- variables are always used with the ${} operator inside strings\n- strings including double-quotes are written with qq() so that the quotes do\nnot have to be escaped\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 247 ++++++++++++++--------------\n 1 file changed, 123 insertions(+), 124 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 52817ba..9773a82 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -18,13 +18,13 @@ use DateTime::Format::ISO8601;\n use warnings;\n \n # By default, use UTF-8 to communicate with Git and the user\n-binmode STDERR, \":encoding(UTF-8)\";\n-binmode STDOUT, \":encoding(UTF-8)\";\n+binmode STDERR, ':encoding(UTF-8)';\n+binmode STDOUT, ':encoding(UTF-8)';\n \n use URI::Escape;\n \n # Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced\n-use constant SLASH_REPLACEMENT => \"%2F\";\n+use constant SLASH_REPLACEMENT => '%2F';\n \n # It's not always possible to delete pages (may require some\n # privileges). Deleted pages are replaced with this content.\n@@ -35,7 +35,7 @@ use constant DELETED_CONTENT => \"[[Category:Deleted]]\\n\";\n use constant EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n \n # used to reflect file creation or deletion in diff.\n-use constant NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n+use constant NULL_SHA1 => '0000000000000000000000000000000000000000';\n \n # Used on Git's side to reflect empty edit messages on the wiki\n use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n@@ -49,35 +49,35 @@ my $url = $ARGV[1];\n \n # Accept both space-separated and multiple keys in config file.\n # Spaces should be written as _ anyway because we'll use chomp.\n-my @tracked_pages = split(/[ \\n]/, run_git(\"config --get-all remote.\". $remotename .\".pages\"));\n+my @tracked_pages = split(/[ \\n]/, run_git(\"config --get-all remote.${remotename}.pages\"));\n chomp(@tracked_pages);\n \n # Just like @tracked_pages, but for MediaWiki categories.\n-my @tracked_categories = split(/[ \\n]/, run_git(\"config --get-all remote.\". $remotename .\".categories\"));\n+my @tracked_categories = split(/[ \\n]/, run_git(\"config --get-all remote.${remotename}.categories\"));\n chomp(@tracked_categories);\n \n # Import media files on pull\n-my $import_media = run_git(\"config --get --bool remote.\". $remotename .\".mediaimport\");\n+my $import_media = run_git(\"config --get --bool remote.${remotename}.mediaimport\");\n chomp($import_media);\n-$import_media = ($import_media eq \"true\");\n+$import_media = ($import_media eq 'true');\n \n # Export media files on push\n-my $export_media = run_git(\"config --get --bool remote.\". $remotename .\".mediaexport\");\n+my $export_media = run_git(\"config --get --bool remote.${remotename}.mediaexport\");\n chomp($export_media);\n-$export_media = !($export_media eq \"false\");\n+$export_media = !($export_media eq 'false');\n \n-my $wiki_login = run_git(\"config --get remote.\". $remotename .\".mwLogin\");\n+my $wiki_login = run_git(\"config --get remote.${remotename}.mwLogin\");\n # Note: mwPassword is discourraged. Use the credential system instead.\n-my $wiki_passwd = run_git(\"config --get remote.\". $remotename .\".mwPassword\");\n-my $wiki_domain = run_git(\"config --get remote.\". $remotename .\".mwDomain\");\n+my $wiki_passwd = run_git(\"config --get remote.${remotename}.mwPassword\");\n+my $wiki_domain = run_git(\"config --get remote.${remotename}.mwDomain\");\n chomp($wiki_login);\n chomp($wiki_passwd);\n chomp($wiki_domain);\n \n # Import only last revisions (both for clone and fetch)\n-my $shallow_import = run_git(\"config --get --bool remote.\". $remotename .\".shallow\");\n+my $shallow_import = run_git(\"config --get --bool remote.${remotename}.shallow\");\n chomp($shallow_import);\n-$shallow_import = ($shallow_import eq \"true\");\n+$shallow_import = ($shallow_import eq 'true');\n \n # Fetch (clone and pull) by revisions instead of by pages. This behavior\n # is more efficient when we have a wiki with lots of pages and we fetch\n@@ -85,13 +85,13 @@ $shallow_import = ($shallow_import eq \"true\");\n # Possible values:\n # - by_rev: perform one query per new revision on the remote wiki\n # - by_page: query each tracked page for new revision\n-my $fetch_strategy = run_git(\"config --get remote.$remotename.fetchStrategy\");\n+my $fetch_strategy = run_git(\"config --get remote.${remotename}.fetchStrategy\");\n unless ($fetch_strategy) {\n-\t$fetch_strategy = run_git(\"config --get mediawiki.fetchStrategy\");\n+\t$fetch_strategy = run_git('config --get mediawiki.fetchStrategy');\n }\n chomp($fetch_strategy);\n unless ($fetch_strategy) {\n-\t$fetch_strategy = \"by_page\";\n+\t$fetch_strategy = 'by_page';\n }\n \n # Remember the timestamp corresponding to a revision id.\n@@ -111,12 +111,12 @@ my %basetimestamps;\n # will get the history with information lost). If the import is\n # deterministic, this means everybody gets the same sha1 for each\n # MediaWiki revision.\n-my $dumb_push = run_git(\"config --get --bool remote.$remotename.dumbPush\");\n+my $dumb_push = run_git(\"config --get --bool remote.${remotename}.dumbPush\");\n unless ($dumb_push) {\n-\t$dumb_push = run_git(\"config --get --bool mediawiki.dumbPush\");\n+\t$dumb_push = run_git('config --get --bool mediawiki.dumbPush');\n }\n chomp($dumb_push);\n-$dumb_push = ($dumb_push eq \"true\");\n+$dumb_push = ($dumb_push eq 'true');\n \n my $wiki_name = $url;\n $wiki_name =~ s{[^/]*://}{};\n@@ -151,22 +151,22 @@ sub parse_command {\n \tif (!defined @cmd) {\n \t\treturn 0;\n \t}\n-\tif ($cmd[0] eq \"capabilities\") {\n+\tif ($cmd[0] eq 'capabilities') {\n \t\tdie(\"Too many arguments for capabilities\\n\")\n \t\t    if (defined($cmd[1]));\n \t\tmw_capabilities();\n-\t} elsif ($cmd[0] eq \"list\") {\n+\t} elsif ($cmd[0] eq 'list') {\n \t\tdie(\"Too many arguments for list\\n\") if (defined($cmd[2]));\n \t\tmw_list($cmd[1]);\n-\t} elsif ($cmd[0] eq \"import\") {\n+\t} elsif ($cmd[0] eq 'import') {\n \t\tdie(\"Invalid arguments for import\\n\")\n \t\t    if ($cmd[1] eq \"\" || defined($cmd[2]));\n \t\tmw_import($cmd[1]);\n-\t} elsif ($cmd[0] eq \"option\") {\n+\t} elsif ($cmd[0] eq 'option') {\n \t\tdie(\"Too many arguments for option\\n\")\n \t\t    if ($cmd[1] eq \"\" || $cmd[2] eq \"\" || defined($cmd[3]));\n \t\tmw_option($cmd[1],$cmd[2]);\n-\t} elsif ($cmd[0] eq \"push\") {\n+\t} elsif ($cmd[0] eq 'push') {\n \t\tmw_push($cmd[1]);\n \t} else {\n \t\tprint STDERR \"Unknown command. Aborting...\\n\";\n@@ -183,7 +183,7 @@ sub mw_connect_maybe {\n \t\treturn;\n \t}\n \t$mediawiki = MediaWiki::API->new;\n-\t$mediawiki->{config}->{api_url} = \"$url/api.php\";\n+\t$mediawiki->{config}->{api_url} = \"${url}/api.php\";\n \tif ($wiki_login) {\n \t\tmy %credential = (\n \t\t\t'url' => $url,\n@@ -196,10 +196,10 @@ sub mw_connect_maybe {\n \t\t\t       lgdomain => $wiki_domain};\n \t\tif ($mediawiki->login($request)) {\n \t\t\tGit::credential \\%credential, 'approve';\n-\t\t\tprint STDERR \"Logged in mediawiki user \\\"$credential{username}\\\".\\n\";\n+\t\t\tprint STDERR qq(Logged in mediawiki user \"$credential{username}\".\\n);\n \t\t} else {\n-\t\t\tprint STDERR \"Failed to log in mediawiki user \\\"$credential{username}\\\" on $url\\n\";\n-\t\t\tprint STDERR \"  (error \" .\n+\t\t\tprint STDERR qq(Failed to log in mediawiki user \"$credential{username}\" on ${url}\\n);\n+\t\t\tprint STDERR '  (error ' .\n \t\t\t\t$mediawiki->{error}->{code} . ': ' .\n \t\t\t\t$mediawiki->{error}->{details} . \")\\n\";\n \t\t\tGit::credential \\%credential, 'reject';\n@@ -239,7 +239,7 @@ sub get_mw_tracked_categories {\n \t\t\t# Mediawiki requires the Category\n \t\t\t# prefix, but let's not force the user\n \t\t\t# to specify it.\n-\t\t\t$category = \"Category:\" . $category;\n+\t\t\t$category = \"Category:${category}\";\n \t\t}\n \t\tmy $mw_pages = $mediawiki->list( {\n \t\t\taction => 'query',\n@@ -265,8 +265,8 @@ sub get_mw_all_pages {\n \t});\n \tif (!defined($mw_pages)) {\n \t\tprint STDERR \"fatal: could not get the list of wiki pages.\\n\";\n-\t\tprint STDERR \"fatal: '$url' does not appear to be a mediawiki\\n\";\n-\t\tprint STDERR \"fatal: make sure '$url/api.php' is a valid page.\\n\";\n+\t\tprint STDERR \"fatal: '${url}' does not appear to be a mediawiki\\n\";\n+\t\tprint STDERR \"fatal: make sure '${url}/api.php' is a valid page.\\n\";\n \t\texit 1;\n \t}\n \tforeach my $page (@{$mw_pages}) {\n@@ -292,8 +292,8 @@ sub get_mw_first_pages {\n \t});\n \tif (!defined($mw_pages)) {\n \t\tprint STDERR \"fatal: could not query the list of wiki pages.\\n\";\n-\t\tprint STDERR \"fatal: '$url' does not appear to be a mediawiki\\n\";\n-\t\tprint STDERR \"fatal: make sure '$url/api.php' is a valid page.\\n\";\n+\t\tprint STDERR \"fatal: '${url}' does not appear to be a mediawiki\\n\";\n+\t\tprint STDERR \"fatal: make sure '${url}/api.php' is a valid page.\\n\";\n \t\texit 1;\n \t}\n \twhile (my ($id, $page) = each(%{$mw_pages->{query}->{pages}})) {\n@@ -343,9 +343,9 @@ sub get_mw_pages {\n #        $out = run_git(\"command args\", \"raw\"); # don't interpret output as UTF-8.\n sub run_git {\n \tmy $args = shift;\n-\tmy $encoding = (shift || \"encoding(UTF-8)\");\n-\topen(my $git, \"-|:$encoding\", \"git \" . $args)\n-\t    or die \"Unable to open: $!\\n\";\n+\tmy $encoding = (shift || 'encoding(UTF-8)');\n+\topen(my $git, \"-|:${encoding}\", \"git ${args}\")\n+\t    or die \"Unable to fork: $!\\n\";\n \tmy $res = do {\n \t\tlocal $/ = undef;\n \t\t<$git>\n@@ -364,7 +364,7 @@ sub get_all_mediafiles {\n \tmy $mw_pages = $mediawiki->list({\n \t\taction => 'query',\n \t\tlist => 'allpages',\n-\t\tapnamespace => get_mw_namespace_id(\"File\"),\n+\t\tapnamespace => get_mw_namespace_id('File'),\n \t\taplimit => 'max'\n \t});\n \tif (!defined($mw_pages)) {\n@@ -401,7 +401,7 @@ sub get_linked_mediafiles {\n \t\t\taction => 'query',\n \t\t\tprop => 'links|images',\n \t\t\ttitles => $mw_titles,\n-\t\t\tplnamespace => get_mw_namespace_id(\"File\"),\n+\t\t\tplnamespace => get_mw_namespace_id('File'),\n \t\t\tpllimit => 'max'\n \t\t};\n \t\tmy $result = $mediawiki->api($query);\n@@ -439,7 +439,7 @@ sub get_mw_mediafile_for_page_revision {\n \tmy $query = {\n \t\taction => 'query',\n \t\tprop => 'imageinfo',\n-\t\ttitles => \"File:\" . $filename,\n+\t\ttitles => \"File:${filename}\",\n \t\tiistart => $timestamp,\n \t\tiiend => $timestamp,\n \t\tiiprop => 'timestamp|archivename|url',\n@@ -471,26 +471,26 @@ sub download_mw_mediafile {\n \t\treturn $response->decoded_content;\n \t} else {\n \t\tprint STDERR \"Error downloading mediafile from :\\n\";\n-\t\tprint STDERR \"URL: $download_url\\n\";\n-\t\tprint STDERR \"Server response: \" . $response->code . \" \" . $response->message . \"\\n\";\n+\t\tprint STDERR \"URL: ${download_url}\\n\";\n+\t\tprint STDERR 'Server response: ' . $response->code . q{ } . $response->message . \"\\n\";\n \t\texit 1;\n \t}\n }\n \n sub get_last_local_revision {\n \t# Get note regarding last mediawiki revision\n-\tmy $note = run_git(\"notes --ref=$remotename/mediawiki show refs/mediawiki/$remotename/master 2>/dev/null\");\n+\tmy $note = run_git(\"notes --ref=${remotename}/mediawiki show refs/mediawiki/${remotename}/master 2>/dev/null\");\n \tmy @note_info = split(/ /, $note);\n \n \tmy $lastrevision_number;\n-\tif (!(defined($note_info[0]) && $note_info[0] eq \"mediawiki_revision:\")) {\n-\t\tprint STDERR \"No previous mediawiki revision found\";\n+\tif (!(defined($note_info[0]) && $note_info[0] eq 'mediawiki_revision:')) {\n+\t\tprint STDERR 'No previous mediawiki revision found';\n \t\t$lastrevision_number = 0;\n \t} else {\n \t\t# Notes are formatted : mediawiki_revision: #number\n \t\t$lastrevision_number = $note_info[1];\n \t\tchomp($lastrevision_number);\n-\t\tprint STDERR \"Last local mediawiki revision found is $lastrevision_number\";\n+\t\tprint STDERR \"Last local mediawiki revision found is ${lastrevision_number}\";\n \t}\n \treturn $lastrevision_number;\n }\n@@ -569,7 +569,7 @@ sub mediawiki_smudge {\n \t\t$string = \"\";\n \t}\n \t# This \\n is important. This is due to mediawiki's way to handle end of files.\n-\treturn $string.\"\\n\";\n+\treturn \"${string}\\n\";\n }\n \n sub mediawiki_clean_filename {\n@@ -591,13 +591,13 @@ sub mediawiki_smudge_filename {\n \t$filename =~ s{/}{@{[SLASH_REPLACEMENT]}}g;\n \t$filename =~ s/ /_/g;\n \t# Decode forbidden characters encoded in mediawiki_clean_filename\n-\t$filename =~ s/_%_([0-9a-fA-F][0-9a-fA-F])/sprintf(\"%c\", hex($1))/ge;\n+\t$filename =~ s/_%_([0-9a-fA-F][0-9a-fA-F])/sprintf('%c', hex($1))/ge;\n \treturn $filename;\n }\n \n sub literal_data {\n \tmy ($content) = @_;\n-\tprint STDOUT \"data \", bytes::length($content), \"\\n\", $content;\n+\tprint STDOUT 'data ', bytes::length($content), \"\\n\", $content;\n \treturn;\n }\n \n@@ -606,9 +606,9 @@ sub literal_data_raw {\n \tmy ($content) = @_;\n \t# Avoid confusion between size in bytes and in characters\n \tutf8::downgrade($content);\n-\tbinmode STDOUT, \":raw\";\n-\tprint STDOUT \"data \", bytes::length($content), \"\\n\", $content;\n-\tbinmode STDOUT, \":encoding(UTF-8)\";\n+\tbinmode STDOUT, ':raw';\n+\tprint STDOUT 'data ', bytes::length($content), \"\\n\", $content;\n+\tbinmode STDOUT, ':encoding(UTF-8)';\n \treturn;\n }\n \n@@ -616,7 +616,7 @@ sub mw_capabilities {\n \t# Revisions are imported to the private namespace\n \t# refs/mediawiki/$remotename/ by the helper and fetched into\n \t# refs/remotes/$remotename later by fetch.\n-\tprint STDOUT \"refspec refs/heads/*:refs/mediawiki/$remotename/*\\n\";\n+\tprint STDOUT \"refspec refs/heads/*:refs/mediawiki/${remotename}/*\\n\";\n \tprint STDOUT \"import\\n\";\n \tprint STDOUT \"list\\n\";\n \tprint STDOUT \"push\\n\";\n@@ -675,7 +675,7 @@ sub fetch_mw_revisions_for_page {\n \t\t@page_revs = sort {$b->{revid} <=> $a->{revid}} (@page_revs);\n \t\treturn $page_revs[0];\n \t}\n-\tprint STDERR \"  Found \", $revnum, \" revision(s).\\n\";\n+\tprint STDERR \"  Found ${revnum} revision(s).\\n\";\n \treturn @page_revs;\n }\n \n@@ -687,8 +687,7 @@ sub fetch_mw_revisions {\n \tmy $n = 1;\n \tforeach my $page (@pages) {\n \t\tmy $id = $page->{pageid};\n-\n-\t\tprint STDERR \"page $n/\", scalar(@pages), \": \". $page->{title} .\"\\n\";\n+\t\tprint STDERR \"page ${n}/\", scalar(@pages), ': ', $page->{title}, \"\\n\";\n \t\t$n++;\n \t\tmy @page_revs = fetch_mw_revisions_for_page($page, $id, $fetch_from);\n \t\t@revisions = (@page_revs, @revisions);\n@@ -702,7 +701,7 @@ sub fe_escape_path {\n     $path =~ s/\\\\/\\\\\\\\/g;\n     $path =~ s/\"/\\\\\"/g;\n     $path =~ s/\\n/\\\\n/g;\n-    return '\"' . $path . '\"';\n+    return qq(\"${path}\");\n }\n \n sub import_file_revision {\n@@ -722,41 +721,41 @@ sub import_file_revision {\n \tmy $author = $commit{author};\n \tmy $date = $commit{date};\n \n-\tprint STDOUT \"commit refs/mediawiki/$remotename/master\\n\";\n-\tprint STDOUT \"mark :$n\\n\";\n-\tprint STDOUT \"committer $author <$author\\@$wiki_name> \", $date->epoch, \" +0000\\n\";\n+\tprint STDOUT \"commit refs/mediawiki/${remotename}/master\\n\";\n+\tprint STDOUT \"mark :${n}\\n\";\n+\tprint STDOUT \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n \tliteral_data($comment);\n \n \t# If it's not a clone, we need to know where to start from\n \tif (!$full_import && $n == 1) {\n-\t\tprint STDOUT \"from refs/mediawiki/$remotename/master^0\\n\";\n+\t\tprint STDOUT \"from refs/mediawiki/${remotename}/master^0\\n\";\n \t}\n \tif ($content ne DELETED_CONTENT) {\n-\t\tprint STDOUT \"M 644 inline \" .\n-\t\t    fe_escape_path($title . \".mw\") . \"\\n\";\n+\t\tprint STDOUT 'M 644 inline ' .\n+\t\t    fe_escape_path(\"${title}.mw\") . \"\\n\";\n \t\tliteral_data($content);\n \t\tif (%mediafile) {\n-\t\t\tprint STDOUT \"M 644 inline \"\n+\t\t\tprint STDOUT 'M 644 inline '\n \t\t\t    . fe_escape_path($mediafile{title}) . \"\\n\";\n \t\t\tliteral_data_raw($mediafile{content});\n \t\t}\n \t\tprint STDOUT \"\\n\\n\";\n \t} else {\n-\t\tprint STDOUT \"D \" . fe_escape_path($title . \".mw\") . \"\\n\";\n+\t\tprint STDOUT 'D ' . fe_escape_path(\"${title}.mw\") . \"\\n\";\n \t}\n \n \t# mediawiki revision number in the git note\n \tif ($full_import && $n == 1) {\n-\t\tprint STDOUT \"reset refs/notes/$remotename/mediawiki\\n\";\n+\t\tprint STDOUT \"reset refs/notes/${remotename}/mediawiki\\n\";\n \t}\n-\tprint STDOUT \"commit refs/notes/$remotename/mediawiki\\n\";\n-\tprint STDOUT \"committer $author <$author\\@$wiki_name> \", $date->epoch, \" +0000\\n\";\n-\tliteral_data(\"Note added by git-mediawiki during import\");\n+\tprint STDOUT \"commit refs/notes/${remotename}/mediawiki\\n\";\n+\tprint STDOUT \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n+\tliteral_data('Note added by git-mediawiki during import');\n \tif (!$full_import && $n == 1) {\n-\t\tprint STDOUT \"from refs/notes/$remotename/mediawiki^0\\n\";\n+\t\tprint STDOUT \"from refs/notes/${remotename}/mediawiki^0\\n\";\n \t}\n-\tprint STDOUT \"N inline :$n\\n\";\n-\tliteral_data(\"mediawiki_revision: \" . $commit{mw_revision});\n+\tprint STDOUT \"N inline :${n}\\n\";\n+\tliteral_data(\"mediawiki_revision: $commit{mw_revision}\");\n \tprint STDOUT \"\\n\\n\";\n \treturn;\n }\n@@ -784,7 +783,7 @@ sub get_more_refs {\n \n sub mw_import {\n \t# multiple import commands can follow each other.\n-\tmy @refs = (shift, get_more_refs(\"import\"));\n+\tmy @refs = (shift, get_more_refs('import'));\n \tforeach my $ref (@refs) {\n \t\tmw_import_ref($ref);\n \t}\n@@ -799,7 +798,7 @@ sub mw_import_ref {\n \t# Since HEAD is a symbolic ref to master (by convention,\n \t# followed by the output of the command \"list\" that we gave),\n \t# we don't need to do anything in this case.\n-\tif ($ref eq \"HEAD\") {\n+\tif ($ref eq 'HEAD') {\n \t\treturn;\n \t}\n \n@@ -815,15 +814,15 @@ sub mw_import_ref {\n \t}\n \n \tmy $n = 0;\n-\tif ($fetch_strategy eq \"by_rev\") {\n+\tif ($fetch_strategy eq 'by_rev') {\n \t\tprint STDERR \"Fetching & writing export data by revs...\\n\";\n \t\t$n = mw_import_ref_by_revs($fetch_from);\n-\t} elsif ($fetch_strategy eq \"by_page\") {\n+\t} elsif ($fetch_strategy eq 'by_page') {\n \t\tprint STDERR \"Fetching & writing export data by pages...\\n\";\n \t\t$n = mw_import_ref_by_pages($fetch_from);\n \t} else {\n-\t\tprint STDERR \"fatal: invalid fetch strategy \\\"$fetch_strategy\\\".\\n\";\n-\t\tprint STDERR \"Check your configuration variables remote.$remotename.fetchStrategy and mediawiki.fetchStrategy\\n\";\n+\t\tprint STDERR qq(fatal: invalid fetch strategy \"${fetch_strategy}\".\\n);\n+\t\tprint STDERR \"Check your configuration variables remote.${remotename}.fetchStrategy and mediawiki.fetchStrategy\\n\";\n \t\texit 1;\n \t}\n \n@@ -897,7 +896,7 @@ sub mw_import_revids {\n \t\t}\n \n \t\tif (!defined($result->{query}->{pages})) {\n-\t\t\tdie \"Invalid revision $pagerevid.\\n\";\n+\t\t\tdie \"Invalid revision ${pagerevid}.\\n\";\n \t\t}\n \n \t\tmy @result_pages = values(%{$result->{query}->{pages}});\n@@ -907,8 +906,8 @@ sub mw_import_revids {\n \t\tmy $page_title = $result_page->{title};\n \n \t\tif (!exists($pages->{$page_title})) {\n-\t\t\tprint STDERR \"$n/\", scalar(@$revision_ids),\n-\t\t\t\t\": Skipping revision #$rev->{revid} of $page_title\\n\";\n+\t\t\tprint STDERR \"${n}/\", scalar(@$revision_ids),\n+\t\t\t\t\": Skipping revision #$rev->{revid} of ${page_title}\\n\";\n \t\t\tnext;\n \t\t}\n \n@@ -933,14 +932,14 @@ sub mw_import_revids {\n \t\tmy %mediafile;\n \t\tif ($namespace) {\n \t\t\tmy $id = get_mw_namespace_id($namespace);\n-\t\t\tif ($id && $id == get_mw_namespace_id(\"File\")) {\n+\t\t\tif ($id && $id == get_mw_namespace_id('File')) {\n \t\t\t\t%mediafile = get_mw_mediafile_for_page_revision($filename, $rev->{timestamp});\n \t\t\t}\n \t\t}\n \t\t# If this is a revision of the media page for new version\n \t\t# of a file do one common commit for both file and media page.\n \t\t# Else do commit only for that page.\n-\t\tprint STDERR \"$n/\", scalar(@$revision_ids), \": Revision #$rev->{revid} of $commit{title}\\n\";\n+\t\tprint STDERR \"${n}/\", scalar(@$revision_ids), \": Revision #$rev->{revid} of $commit{title}\\n\";\n \t\timport_file_revision(\\%commit, ($fetch_from == 1), $n_actual, \\%mediafile);\n \t}\n \n@@ -948,9 +947,9 @@ sub mw_import_revids {\n }\n \n sub error_non_fast_forward {\n-\tmy $advice = run_git(\"config --bool advice.pushNonFastForward\");\n+\tmy $advice = run_git('config --bool advice.pushNonFastForward');\n \tchomp($advice);\n-\tif ($advice ne \"false\") {\n+\tif ($advice ne 'false') {\n \t\t# Native git-push would show this after the summary.\n \t\t# We can't ask it to display it cleanly, so print it\n \t\t# ourselves before.\n@@ -958,7 +957,7 @@ sub error_non_fast_forward {\n \t\tprint STDERR \"Merge the remote changes (e.g. 'git pull') before pushing again. See the\\n\";\n \t\tprint STDERR \"'Note about fast-forwards' section of 'git push --help' for details.\\n\";\n \t}\n-\tprint STDOUT \"error $_[0] \\\"non-fast-forward\\\"\\n\";\n+\tprint STDOUT qq(error $_[0] \"non-fast-forward\"\\n);\n \treturn 0;\n }\n \n@@ -969,10 +968,10 @@ sub mw_upload_file {\n \tmy $file_deleted = shift;\n \tmy $summary = shift;\n \tmy $newrevid;\n-\tmy $path = \"File:\" . $complete_file_name;\n+\tmy $path = \"File:${complete_file_name}\";\n \tmy %hashFiles = get_allowed_file_extensions();\n \tif (!exists($hashFiles{$extension})) {\n-\t\tprint STDERR \"$complete_file_name is not a permitted file on this wiki.\\n\";\n+\t\tprint STDERR \"${complete_file_name} is not a permitted file on this wiki.\\n\";\n \t\tprint STDERR \"Check the configuration of file uploads in your mediawiki.\\n\";\n \t\treturn $newrevid;\n \t}\n@@ -992,11 +991,11 @@ sub mw_upload_file {\n \t\t}\n \t} else {\n \t\t# Don't let perl try to interpret file content as UTF-8 => use \"raw\"\n-\t\tmy $content = run_git(\"cat-file blob $new_sha1\", \"raw\");\n+\t\tmy $content = run_git(\"cat-file blob ${new_sha1}\", 'raw');\n \t\tif ($content ne \"\") {\n \t\t\tmw_connect_maybe();\n \t\t\t$mediawiki->{config}->{upload_url} =\n-\t\t\t\t\"$url/index.php/Special:Upload\";\n+\t\t\t\t\"${url}/index.php/Special:Upload\";\n \t\t\t$mediawiki->edit({\n \t\t\t\taction => 'upload',\n \t\t\t\tfilename => $complete_file_name,\n@@ -1011,9 +1010,9 @@ sub mw_upload_file {\n \t\t\t\t . $mediawiki->{error}->{details} . \"\\n\";\n \t\t\tmy $last_file_page = $mediawiki->get_page({title => $path});\n \t\t\t$newrevid = $last_file_page->{revid};\n-\t\t\tprint STDERR \"Pushed file: $new_sha1 - $complete_file_name.\\n\";\n+\t\t\tprint STDERR \"Pushed file: ${new_sha1} - ${complete_file_name}.\\n\";\n \t\t} else {\n-\t\t\tprint STDERR \"Empty file $complete_file_name not pushed.\\n\";\n+\t\t\tprint STDERR \"Empty file ${complete_file_name} not pushed.\\n\";\n \t\t}\n \t}\n \treturn $newrevid;\n@@ -1048,11 +1047,11 @@ sub mw_push_file {\n \tif (!defined($extension)) {\n \t\t$extension = \"\";\n \t}\n-\tif ($extension eq \"mw\") {\n+\tif ($extension eq 'mw') {\n \t\tmy $ns = get_mw_namespace_id_for_page($complete_file_name);\n-\t\tif ($ns && $ns == get_mw_namespace_id(\"File\") && (!$export_media)) {\n-\t\t\tprint STDERR \"Ignoring media file related page: $complete_file_name\\n\";\n-\t\t\treturn ($oldrevid, \"ok\");\n+\t\tif ($ns && $ns == get_mw_namespace_id('File') && (!$export_media)) {\n+\t\t\tprint STDERR \"Ignoring media file related page: ${complete_file_name}\\n\";\n+\t\t\treturn ($oldrevid, 'ok');\n \t\t}\n \t\tmy $file_content;\n \t\tif ($page_deleted) {\n@@ -1062,7 +1061,7 @@ sub mw_push_file {\n \t\t\t# with this content instead:\n \t\t\t$file_content = DELETED_CONTENT;\n \t\t} else {\n-\t\t\t$file_content = run_git(\"cat-file blob $new_sha1\");\n+\t\t\t$file_content = run_git(\"cat-file blob ${new_sha1}\");\n \t\t}\n \n \t\tmw_connect_maybe();\n@@ -1083,7 +1082,7 @@ sub mw_push_file {\n \t\t\t\t    $mediawiki->{error}->{code} .\n \t\t\t\t    ' from mediwiki: ' . $mediawiki->{error}->{details} .\n \t\t\t\t    \".\\n\";\n-\t\t\t\treturn ($oldrevid, \"non-fast-forward\");\n+\t\t\t\treturn ($oldrevid, 'non-fast-forward');\n \t\t\t} else {\n \t\t\t\t# Other errors. Shouldn't happen => just die()\n \t\t\t\tdie 'Fatal: Error ' .\n@@ -1092,21 +1091,21 @@ sub mw_push_file {\n \t\t\t}\n \t\t}\n \t\t$newrevid = $result->{edit}->{newrevid};\n-\t\tprint STDERR \"Pushed file: $new_sha1 - $title\\n\";\n+\t\tprint STDERR \"Pushed file: ${new_sha1} - ${title}\\n\";\n \t} elsif ($export_media) {\n \t\t$newrevid = mw_upload_file($complete_file_name, $new_sha1,\n \t\t\t\t\t   $extension, $page_deleted,\n \t\t\t\t\t   $summary);\n \t} else {\n-\t\tprint STDERR \"Ignoring media file $title\\n\";\n+\t\tprint STDERR \"Ignoring media file ${title}\\n\";\n \t}\n \t$newrevid = ($newrevid or $oldrevid);\n-\treturn ($newrevid, \"ok\");\n+\treturn ($newrevid, 'ok');\n }\n \n sub mw_push {\n \t# multiple push statements can follow each other\n-\tmy @refsspecs = (shift, get_more_refs(\"push\"));\n+\tmy @refsspecs = (shift, get_more_refs('push'));\n \tmy $pushed;\n \tfor my $refspec (@refsspecs) {\n \t\tmy ($force, $local, $remote) = $refspec =~ /^(\\+)?([^:]*):([^:]*)$/\n@@ -1116,12 +1115,12 @@ sub mw_push {\n \t\t}\n \t\tif ($local eq \"\") {\n \t\t\tprint STDERR \"Cannot delete remote branch on a MediaWiki\\n\";\n-\t\t\tprint STDOUT \"error $remote cannot delete\\n\";\n+\t\t\tprint STDOUT \"error ${remote} cannot delete\\n\";\n \t\t\tnext;\n \t\t}\n-\t\tif ($remote ne \"refs/heads/master\") {\n+\t\tif ($remote ne 'refs/heads/master') {\n \t\t\tprint STDERR \"Only push to the branch 'master' is supported on a MediaWiki\\n\";\n-\t\t\tprint STDOUT \"error $remote only master allowed\\n\";\n+\t\t\tprint STDOUT \"error ${remote} only master allowed\\n\";\n \t\t\tnext;\n \t\t}\n \t\tif (mw_push_revision($local, $remote)) {\n@@ -1152,9 +1151,10 @@ sub mw_push_revision {\n \tmy $mw_revision = $last_remote_revid;\n \n \t# Get sha1 of commit pointed by local HEAD\n-\tmy $HEAD_sha1 = run_git(\"rev-parse $local 2>/dev/null\"); chomp($HEAD_sha1);\n+\tmy $HEAD_sha1 = run_git(\"rev-parse ${local} 2>/dev/null\");\n+\tchomp($HEAD_sha1);\n \t# Get sha1 of commit pointed by remotes/$remotename/master\n-\tmy $remoteorigin_sha1 = run_git(\"rev-parse refs/remotes/$remotename/master 2>/dev/null\");\n+\tmy $remoteorigin_sha1 = run_git(\"rev-parse refs/remotes/${remotename}/master 2>/dev/null\");\n \tchomp($remoteorigin_sha1);\n \n \tif ($last_local_revid > 0 &&\n@@ -1174,7 +1174,7 @@ sub mw_push_revision {\n \t\tmy $parsed_sha1 = $remoteorigin_sha1;\n \t\t# Find a path from last MediaWiki commit to pushed commit\n \t\tprint STDERR \"Computing path from local to remote ...\\n\";\n-\t\tmy @local_ancestry = split(/\\n/, run_git(\"rev-list --boundary --parents $local ^$parsed_sha1\"));\n+\t\tmy @local_ancestry = split(/\\n/, run_git(\"rev-list --boundary --parents ${local} ^${parsed_sha1}\"));\n \t\tmy %local_ancestry;\n \t\tforeach my $line (@local_ancestry) {\n \t\t\tif (my ($child, $parents) = $line =~ /^-?([a-f0-9]+) ([a-f0-9 ]+)/) {\n@@ -1182,7 +1182,7 @@ sub mw_push_revision {\n \t\t\t\t\t$local_ancestry{$parent} = $child;\n \t\t\t\t}\n \t\t\t} elsif (!$line =~ /^([a-f0-9]+)/) {\n-\t\t\t\tdie \"Unexpected output from git rev-list: $line\\n\";\n+\t\t\t\tdie \"Unexpected output from git rev-list: ${line}\\n\";\n \t\t\t}\n \t\t}\n \t\twhile ($parsed_sha1 ne $HEAD_sha1) {\n@@ -1198,7 +1198,7 @@ sub mw_push_revision {\n \t\t# No remote mediawiki revision. Export the whole\n \t\t# history (linearized with --first-parent)\n \t\tprint STDERR \"Warning: no common ancestor, pushing complete history\\n\";\n-\t\tmy $history = run_git(\"rev-list --first-parent --children $local\");\n+\t\tmy $history = run_git(\"rev-list --first-parent --children ${local}\");\n \t\tmy @history = split(/\\n/, $history);\n \t\t@history = @history[1..$#history];\n \t\tforeach my $line (reverse @history) {\n@@ -1210,12 +1210,12 @@ sub mw_push_revision {\n \tforeach my $commit_info_split (@commit_pairs) {\n \t\tmy $sha1_child = @{$commit_info_split}[0];\n \t\tmy $sha1_commit = @{$commit_info_split}[1];\n-\t\tmy $diff_infos = run_git(\"diff-tree -r --raw -z $sha1_child $sha1_commit\");\n+\t\tmy $diff_infos = run_git(\"diff-tree -r --raw -z ${sha1_child} ${sha1_commit}\");\n \t\t# TODO: we could detect rename, and encode them with a #redirect on the wiki.\n \t\t# TODO: for now, it's just a delete+add\n \t\tmy @diff_info_list = split(/\\0/, $diff_infos);\n \t\t# Keep the subject line of the commit message as mediawiki comment for the revision\n-\t\tmy $commit_msg = run_git(\"log --no-walk --format=\\\"%s\\\" $sha1_commit\");\n+\t\tmy $commit_msg = run_git(qq(log --no-walk --format=\"%s\" ${sha1_commit}));\n \t\tchomp($commit_msg);\n \t\t# Push every blob\n \t\twhile (@diff_info_list) {\n@@ -1227,7 +1227,7 @@ sub mw_push_revision {\n \t\t\tmy $info = shift(@diff_info_list);\n \t\t\tmy $file = shift(@diff_info_list);\n \t\t\t($mw_revision, $status) = mw_push_file($info, $file, $commit_msg, $mw_revision);\n-\t\t\tif ($status eq \"non-fast-forward\") {\n+\t\t\tif ($status eq 'non-fast-forward') {\n \t\t\t\t# we may already have sent part of the\n \t\t\t\t# commit to MediaWiki, but it's too\n \t\t\t\t# late to cancel it. Stop the push in\n@@ -1235,17 +1235,17 @@ sub mw_push_revision {\n \t\t\t\t# accurate error message.\n \t\t\t\treturn error_non_fast_forward($remote);\n \t\t\t}\n-\t\t\tif ($status ne \"ok\") {\n+\t\t\tif ($status ne 'ok') {\n \t\t\t\tdie(\"Unknown error from mw_push_file()\\n\");\n \t\t\t}\n \t\t}\n \t\tunless ($dumb_push) {\n-\t\t\trun_git(\"notes --ref=$remotename/mediawiki add -f -m \\\"mediawiki_revision: $mw_revision\\\" $sha1_commit\");\n-\t\t\trun_git(\"update-ref -m \\\"Git-MediaWiki push\\\" refs/mediawiki/$remotename/master $sha1_commit $sha1_child\");\n+\t\t\trun_git(qq(notes --ref=${remotename}/mediawiki add -f -m \"mediawiki_revision: ${mw_revision}\" ${sha1_commit}));\n+\t\t\trun_git(qq(update-ref -m \"Git-MediaWiki push\" refs/mediawiki/${remotename}/master ${sha1_commit} ${sha1_child}));\n \t\t}\n \t}\n \n-\tprint STDOUT \"ok $remote\\n\";\n+\tprint STDOUT \"ok ${remote}\\n\";\n \treturn 1;\n }\n \n@@ -1281,8 +1281,8 @@ sub get_mw_namespace_id {\n \t\t# Look at configuration file, if the record for that namespace is\n \t\t# already cached. Namespaces are stored in form:\n \t\t# \"Name_of_namespace:Id_namespace\", ex.: \"File:6\".\n-\t\tmy @temp = split(/\\n/, run_git(\"config --get-all remote.\"\n-\t\t\t\t\t\t. $remotename .\".namespaceCache\"));\n+\t\tmy @temp = split(/\\n/,\n+\t\t\t\t run_git(\"config --get-all remote.${remotename}.namespaceCache\"));\n \t\tchomp(@temp);\n \t\tforeach my $ns (@temp) {\n \t\t\tmy ($n, $id) = split(/:/, $ns);\n@@ -1296,7 +1296,7 @@ sub get_mw_namespace_id {\n \t}\n \n \tif (!exists $namespace_id{$name}) {\n-\t\tprint STDERR \"Namespace $name not found in cache, querying the wiki ...\\n\";\n+\t\tprint STDERR \"Namespace ${name} not found in cache, querying the wiki ...\\n\";\n \t\t# NS not found => get namespace id from MW and store it in\n \t        # configuration file.\n \t        my $query = {\n@@ -1321,7 +1321,7 @@ sub get_mw_namespace_id {\n \tmy $id;\n \n \tunless (defined $ns) {\n-\t\tprint STDERR \"No such namespace $name on MediaWiki.\\n\";\n+\t\tprint STDERR \"No such namespace ${name} on MediaWiki.\\n\";\n \t\t$ns = {is_namespace => 0};\n \t\t$namespace_id{$name} = $ns;\n \t}\n@@ -1335,8 +1335,7 @@ sub get_mw_namespace_id {\n \n \t# Store explicitely requested namespaces on disk\n \tif (!exists $cached_mw_namespace_id{$name}) {\n-\t\trun_git(\"config --add remote.\". $remotename\n-\t\t\t.\".namespaceCache \\\"\". $name .\":\". $store_id .\"\\\"\");\n+\t\trun_git(qq(config --add remote.${remotename}.namespaceCache \"${name}:${store_id}\"));\n \t\t$cached_mw_namespace_id{$name} = 1;\n \t}\n \treturn $id;\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220626","messageId":"1371051828-12866-24-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 23/31] git-remote-mediawiki: Brace file handles for print for more clarity","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:40Z","receivedAt":"2013-06-12T15:43:40Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"This follows the following rule:\nInputOutput::RequireBracedFileHandleWithPrint (Severity: 1)\n    The `print' and `printf' functions have a unique syntax that supports an\n    optional file handle argument. Conway suggests wrapping this argument in\n    braces to make it visually stand out from the other arguments. When you\n    put braces around any of the special package-level file handles like\n    `STDOUT', `STDERR', and `DATA', you must the `'*'' sigil or else it\n    won't compile under `use strict 'subs''.\n\n      print $FH   \"Mary had a little lamb\\n\";  #not ok\n      print {$FH} \"Mary had a little lamb\\n\";  #ok\n\n      print   STDERR   $foo, $bar, $baz;  #not ok\n      print  {STDERR}  $foo, $bar, $baz;  #won't compile under 'strict'\n      print {*STDERR}  $foo, $bar, $baz;  #perfect!\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 202 ++++++++++++++--------------\n 1 file changed, 101 insertions(+), 101 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 9773a82..8b0144c 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -169,7 +169,7 @@ sub parse_command {\n \t} elsif ($cmd[0] eq 'push') {\n \t\tmw_push($cmd[1]);\n \t} else {\n-\t\tprint STDERR \"Unknown command. Aborting...\\n\";\n+\t\tprint {*STDERR} \"Unknown command. Aborting...\\n\";\n \t\treturn 0;\n \t}\n \treturn 1;\n@@ -196,10 +196,10 @@ sub mw_connect_maybe {\n \t\t\t       lgdomain => $wiki_domain};\n \t\tif ($mediawiki->login($request)) {\n \t\t\tGit::credential \\%credential, 'approve';\n-\t\t\tprint STDERR qq(Logged in mediawiki user \"$credential{username}\".\\n);\n+\t\t\tprint {*STDERR} qq(Logged in mediawiki user \"$credential{username}\".\\n);\n \t\t} else {\n-\t\t\tprint STDERR qq(Failed to log in mediawiki user \"$credential{username}\" on ${url}\\n);\n-\t\t\tprint STDERR '  (error ' .\n+\t\t\tprint {*STDERR} qq(Failed to log in mediawiki user \"$credential{username}\" on ${url}\\n);\n+\t\t\tprint {*STDERR} '  (error ' .\n \t\t\t\t$mediawiki->{error}->{code} . ': ' .\n \t\t\t\t$mediawiki->{error}->{details} . \")\\n\";\n \t\t\tGit::credential \\%credential, 'reject';\n@@ -264,9 +264,9 @@ sub get_mw_all_pages {\n \t\taplimit => 'max'\n \t});\n \tif (!defined($mw_pages)) {\n-\t\tprint STDERR \"fatal: could not get the list of wiki pages.\\n\";\n-\t\tprint STDERR \"fatal: '${url}' does not appear to be a mediawiki\\n\";\n-\t\tprint STDERR \"fatal: make sure '${url}/api.php' is a valid page.\\n\";\n+\t\tprint {*STDERR} \"fatal: could not get the list of wiki pages.\\n\";\n+\t\tprint {*STDERR} \"fatal: '${url}' does not appear to be a mediawiki\\n\";\n+\t\tprint {*STDERR} \"fatal: make sure '${url}/api.php' is a valid page.\\n\";\n \t\texit 1;\n \t}\n \tforeach my $page (@{$mw_pages}) {\n@@ -291,14 +291,14 @@ sub get_mw_first_pages {\n \t\ttitles => $titles,\n \t});\n \tif (!defined($mw_pages)) {\n-\t\tprint STDERR \"fatal: could not query the list of wiki pages.\\n\";\n-\t\tprint STDERR \"fatal: '${url}' does not appear to be a mediawiki\\n\";\n-\t\tprint STDERR \"fatal: make sure '${url}/api.php' is a valid page.\\n\";\n+\t\tprint {*STDERR} \"fatal: could not query the list of wiki pages.\\n\";\n+\t\tprint {*STDERR} \"fatal: '${url}' does not appear to be a mediawiki\\n\";\n+\t\tprint {*STDERR} \"fatal: make sure '${url}/api.php' is a valid page.\\n\";\n \t\texit 1;\n \t}\n \twhile (my ($id, $page) = each(%{$mw_pages->{query}->{pages}})) {\n \t\tif ($id < 0) {\n-\t\t\tprint STDERR \"Warning: page $page->{title} not found on wiki\\n\";\n+\t\t\tprint {*STDERR} \"Warning: page $page->{title} not found on wiki\\n\";\n \t\t} else {\n \t\t\t$pages->{$page->{title}} = $page;\n \t\t}\n@@ -310,7 +310,7 @@ sub get_mw_first_pages {\n sub get_mw_pages {\n \tmw_connect_maybe();\n \n-\tprint STDERR \"Listing pages on remote wiki...\\n\";\n+\tprint {*STDERR} \"Listing pages on remote wiki...\\n\";\n \n \tmy %pages; # hash on page titles to avoid duplicates\n \tmy $user_defined;\n@@ -328,14 +328,14 @@ sub get_mw_pages {\n \t\tget_mw_all_pages(\\%pages);\n \t}\n \tif ($import_media) {\n-\t\tprint STDERR \"Getting media files for selected pages...\\n\";\n+\t\tprint {*STDERR} \"Getting media files for selected pages...\\n\";\n \t\tif ($user_defined) {\n \t\t\tget_linked_mediafiles(\\%pages);\n \t\t} else {\n \t\t\tget_all_mediafiles(\\%pages);\n \t\t}\n \t}\n-\tprint STDERR (scalar keys %pages) . \" pages found.\\n\";\n+\tprint {*STDERR} (scalar keys %pages) . \" pages found.\\n\";\n \treturn %pages;\n }\n \n@@ -368,9 +368,9 @@ sub get_all_mediafiles {\n \t\taplimit => 'max'\n \t});\n \tif (!defined($mw_pages)) {\n-\t\tprint STDERR \"fatal: could not get the list of pages for media files.\\n\";\n-\t\tprint STDERR \"fatal: '$url' does not appear to be a mediawiki\\n\";\n-\t\tprint STDERR \"fatal: make sure '$url/api.php' is a valid page.\\n\";\n+\t\tprint {*STDERR} \"fatal: could not get the list of pages for media files.\\n\";\n+\t\tprint {*STDERR} \"fatal: '$url' does not appear to be a mediawiki\\n\";\n+\t\tprint {*STDERR} \"fatal: make sure '$url/api.php' is a valid page.\\n\";\n \t\texit 1;\n \t}\n \tforeach my $page (@{$mw_pages}) {\n@@ -457,7 +457,7 @@ sub get_mw_mediafile_for_page_revision {\n \t\t$mediafile{timestamp} = $fileinfo->{timestamp};\n \t\t# Mediawiki::API's download function doesn't support https URLs\n \t\t# and can't download old versions of files.\n-\t\tprint STDERR \"\\tDownloading file $mediafile{title}, version $mediafile{timestamp}\\n\";\n+\t\tprint {*STDERR} \"\\tDownloading file $mediafile{title}, version $mediafile{timestamp}\\n\";\n \t\t$mediafile{content} = download_mw_mediafile($fileinfo->{url});\n \t}\n \treturn %mediafile;\n@@ -470,9 +470,9 @@ sub download_mw_mediafile {\n \tif ($response->code == 200) {\n \t\treturn $response->decoded_content;\n \t} else {\n-\t\tprint STDERR \"Error downloading mediafile from :\\n\";\n-\t\tprint STDERR \"URL: ${download_url}\\n\";\n-\t\tprint STDERR 'Server response: ' . $response->code . q{ } . $response->message . \"\\n\";\n+\t\tprint {*STDERR} \"Error downloading mediafile from :\\n\";\n+\t\tprint {*STDERR} \"URL: ${download_url}\\n\";\n+\t\tprint {*STDERR} 'Server response: ' . $response->code . q{ } . $response->message . \"\\n\";\n \t\texit 1;\n \t}\n }\n@@ -484,13 +484,13 @@ sub get_last_local_revision {\n \n \tmy $lastrevision_number;\n \tif (!(defined($note_info[0]) && $note_info[0] eq 'mediawiki_revision:')) {\n-\t\tprint STDERR 'No previous mediawiki revision found';\n+\t\tprint {*STDERR} 'No previous mediawiki revision found';\n \t\t$lastrevision_number = 0;\n \t} else {\n \t\t# Notes are formatted : mediawiki_revision: #number\n \t\t$lastrevision_number = $note_info[1];\n \t\tchomp($lastrevision_number);\n-\t\tprint STDERR \"Last local mediawiki revision found is ${lastrevision_number}\";\n+\t\tprint {*STDERR} \"Last local mediawiki revision found is ${lastrevision_number}\";\n \t}\n \treturn $lastrevision_number;\n }\n@@ -523,7 +523,7 @@ sub get_last_remote_revision {\n \n \tmy $max_rev_num = 0;\n \n-\tprint STDERR \"Getting last revision id on tracked pages...\\n\";\n+\tprint {*STDERR} \"Getting last revision id on tracked pages...\\n\";\n \n \tforeach my $page (@pages) {\n \t\tmy $id = $page->{pageid};\n@@ -544,7 +544,7 @@ sub get_last_remote_revision {\n \t\t$max_rev_num = ($lastrev->{revid} > $max_rev_num ? $lastrev->{revid} : $max_rev_num);\n \t}\n \n-\tprint STDERR \"Last remote revision found is $max_rev_num.\\n\";\n+\tprint {*STDERR} \"Last remote revision found is $max_rev_num.\\n\";\n \treturn $max_rev_num;\n }\n \n@@ -597,7 +597,7 @@ sub mediawiki_smudge_filename {\n \n sub literal_data {\n \tmy ($content) = @_;\n-\tprint STDOUT 'data ', bytes::length($content), \"\\n\", $content;\n+\tprint {*STDOUT} 'data ', bytes::length($content), \"\\n\", $content;\n \treturn;\n }\n \n@@ -606,9 +606,9 @@ sub literal_data_raw {\n \tmy ($content) = @_;\n \t# Avoid confusion between size in bytes and in characters\n \tutf8::downgrade($content);\n-\tbinmode STDOUT, ':raw';\n-\tprint STDOUT 'data ', bytes::length($content), \"\\n\", $content;\n-\tbinmode STDOUT, ':encoding(UTF-8)';\n+\tbinmode {*STDOUT}, ':raw';\n+\tprint {*STDOUT} 'data ', bytes::length($content), \"\\n\", $content;\n+\tbinmode {*STDOUT}, ':encoding(UTF-8)';\n \treturn;\n }\n \n@@ -616,26 +616,26 @@ sub mw_capabilities {\n \t# Revisions are imported to the private namespace\n \t# refs/mediawiki/$remotename/ by the helper and fetched into\n \t# refs/remotes/$remotename later by fetch.\n-\tprint STDOUT \"refspec refs/heads/*:refs/mediawiki/${remotename}/*\\n\";\n-\tprint STDOUT \"import\\n\";\n-\tprint STDOUT \"list\\n\";\n-\tprint STDOUT \"push\\n\";\n-\tprint STDOUT \"\\n\";\n+\tprint {*STDOUT} \"refspec refs/heads/*:refs/mediawiki/${remotename}/*\\n\";\n+\tprint {*STDOUT} \"import\\n\";\n+\tprint {*STDOUT} \"list\\n\";\n+\tprint {*STDOUT} \"push\\n\";\n+\tprint {*STDOUT} \"\\n\";\n \treturn;\n }\n \n sub mw_list {\n \t# MediaWiki do not have branches, we consider one branch arbitrarily\n \t# called master, and HEAD pointing to it.\n-\tprint STDOUT \"? refs/heads/master\\n\";\n-\tprint STDOUT \"\\@refs/heads/master HEAD\\n\";\n-\tprint STDOUT \"\\n\";\n+\tprint {*STDOUT} \"? refs/heads/master\\n\";\n+\tprint {*STDOUT} \"\\@refs/heads/master HEAD\\n\";\n+\tprint {*STDOUT} \"\\n\";\n \treturn;\n }\n \n sub mw_option {\n-\tprint STDERR \"remote-helper command 'option $_[0]' not yet implemented\\n\";\n-\tprint STDOUT \"unsupported\\n\";\n+\tprint {*STDERR} \"remote-helper command 'option $_[0]' not yet implemented\\n\";\n+\tprint {*STDOUT} \"unsupported\\n\";\n \treturn;\n }\n \n@@ -671,11 +671,11 @@ sub fetch_mw_revisions_for_page {\n \t\t$query->{rvstartid} = $result->{'query-continue'}->{revisions}->{rvstartid};\n \t}\n \tif ($shallow_import && @page_revs) {\n-\t\tprint STDERR \"  Found 1 revision (shallow import).\\n\";\n+\t\tprint {*STDERR} \"  Found 1 revision (shallow import).\\n\";\n \t\t@page_revs = sort {$b->{revid} <=> $a->{revid}} (@page_revs);\n \t\treturn $page_revs[0];\n \t}\n-\tprint STDERR \"  Found ${revnum} revision(s).\\n\";\n+\tprint {*STDERR} \"  Found ${revnum} revision(s).\\n\";\n \treturn @page_revs;\n }\n \n@@ -687,7 +687,7 @@ sub fetch_mw_revisions {\n \tmy $n = 1;\n \tforeach my $page (@pages) {\n \t\tmy $id = $page->{pageid};\n-\t\tprint STDERR \"page ${n}/\", scalar(@pages), ': ', $page->{title}, \"\\n\";\n+\t\tprint {*STDERR} \"page ${n}/\", scalar(@pages), ': ', $page->{title}, \"\\n\";\n \t\t$n++;\n \t\tmy @page_revs = fetch_mw_revisions_for_page($page, $id, $fetch_from);\n \t\t@revisions = (@page_revs, @revisions);\n@@ -721,42 +721,42 @@ sub import_file_revision {\n \tmy $author = $commit{author};\n \tmy $date = $commit{date};\n \n-\tprint STDOUT \"commit refs/mediawiki/${remotename}/master\\n\";\n-\tprint STDOUT \"mark :${n}\\n\";\n-\tprint STDOUT \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n+\tprint {*STDOUT} \"commit refs/mediawiki/${remotename}/master\\n\";\n+\tprint {*STDOUT} \"mark :${n}\\n\";\n+\tprint {*STDOUT} \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n \tliteral_data($comment);\n \n \t# If it's not a clone, we need to know where to start from\n \tif (!$full_import && $n == 1) {\n-\t\tprint STDOUT \"from refs/mediawiki/${remotename}/master^0\\n\";\n+\t\tprint {*STDOUT} \"from refs/mediawiki/${remotename}/master^0\\n\";\n \t}\n \tif ($content ne DELETED_CONTENT) {\n-\t\tprint STDOUT 'M 644 inline ' .\n+\t\tprint {*STDOUT} 'M 644 inline ' .\n \t\t    fe_escape_path(\"${title}.mw\") . \"\\n\";\n \t\tliteral_data($content);\n \t\tif (%mediafile) {\n-\t\t\tprint STDOUT 'M 644 inline '\n+\t\t\tprint {*STDOUT} 'M 644 inline '\n \t\t\t    . fe_escape_path($mediafile{title}) . \"\\n\";\n \t\t\tliteral_data_raw($mediafile{content});\n \t\t}\n-\t\tprint STDOUT \"\\n\\n\";\n+\t\tprint {*STDOUT} \"\\n\\n\";\n \t} else {\n-\t\tprint STDOUT 'D ' . fe_escape_path(\"${title}.mw\") . \"\\n\";\n+\t\tprint {*STDOUT} 'D ' . fe_escape_path(\"${title}.mw\") . \"\\n\";\n \t}\n \n \t# mediawiki revision number in the git note\n \tif ($full_import && $n == 1) {\n-\t\tprint STDOUT \"reset refs/notes/${remotename}/mediawiki\\n\";\n+\t\tprint {*STDOUT} \"reset refs/notes/${remotename}/mediawiki\\n\";\n \t}\n-\tprint STDOUT \"commit refs/notes/${remotename}/mediawiki\\n\";\n-\tprint STDOUT \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n+\tprint {*STDOUT} \"commit refs/notes/${remotename}/mediawiki\\n\";\n+\tprint {*STDOUT} \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n \tliteral_data('Note added by git-mediawiki during import');\n \tif (!$full_import && $n == 1) {\n-\t\tprint STDOUT \"from refs/notes/${remotename}/mediawiki^0\\n\";\n+\t\tprint {*STDOUT} \"from refs/notes/${remotename}/mediawiki^0\\n\";\n \t}\n-\tprint STDOUT \"N inline :${n}\\n\";\n+\tprint {*STDOUT} \"N inline :${n}\\n\";\n \tliteral_data(\"mediawiki_revision: $commit{mw_revision}\");\n-\tprint STDOUT \"\\n\\n\";\n+\tprint {*STDOUT} \"\\n\\n\";\n \treturn;\n }\n \n@@ -787,7 +787,7 @@ sub mw_import {\n \tforeach my $ref (@refs) {\n \t\tmw_import_ref($ref);\n \t}\n-\tprint STDOUT \"done\\n\";\n+\tprint {*STDOUT} \"done\\n\";\n \treturn;\n }\n \n@@ -804,30 +804,30 @@ sub mw_import_ref {\n \n \tmw_connect_maybe();\n \n-\tprint STDERR \"Searching revisions...\\n\";\n+\tprint {*STDERR} \"Searching revisions...\\n\";\n \tmy $last_local = get_last_local_revision();\n \tmy $fetch_from = $last_local + 1;\n \tif ($fetch_from == 1) {\n-\t\tprint STDERR \", fetching from beginning.\\n\";\n+\t\tprint {*STDERR} \", fetching from beginning.\\n\";\n \t} else {\n-\t\tprint STDERR \", fetching from here.\\n\";\n+\t\tprint {*STDERR} \", fetching from here.\\n\";\n \t}\n \n \tmy $n = 0;\n \tif ($fetch_strategy eq 'by_rev') {\n-\t\tprint STDERR \"Fetching & writing export data by revs...\\n\";\n+\t\tprint {*STDERR} \"Fetching & writing export data by revs...\\n\";\n \t\t$n = mw_import_ref_by_revs($fetch_from);\n \t} elsif ($fetch_strategy eq 'by_page') {\n-\t\tprint STDERR \"Fetching & writing export data by pages...\\n\";\n+\t\tprint {*STDERR} \"Fetching & writing export data by pages...\\n\";\n \t\t$n = mw_import_ref_by_pages($fetch_from);\n \t} else {\n-\t\tprint STDERR qq(fatal: invalid fetch strategy \"${fetch_strategy}\".\\n);\n-\t\tprint STDERR \"Check your configuration variables remote.${remotename}.fetchStrategy and mediawiki.fetchStrategy\\n\";\n+\t\tprint {*STDERR} qq(fatal: invalid fetch strategy \"${fetch_strategy}\".\\n);\n+\t\tprint {*STDERR} \"Check your configuration variables remote.${remotename}.fetchStrategy and mediawiki.fetchStrategy\\n\";\n \t\texit 1;\n \t}\n \n \tif ($fetch_from == 1 && $n == 0) {\n-\t\tprint STDERR \"You appear to have cloned an empty MediaWiki.\\n\";\n+\t\tprint {*STDERR} \"You appear to have cloned an empty MediaWiki.\\n\";\n \t\t# Something has to be done remote-helper side. If nothing is done, an error is\n \t\t# thrown saying that HEAD is referring to unknown object 0000000000000000000\n \t\t# and the clone fails.\n@@ -906,7 +906,7 @@ sub mw_import_revids {\n \t\tmy $page_title = $result_page->{title};\n \n \t\tif (!exists($pages->{$page_title})) {\n-\t\t\tprint STDERR \"${n}/\", scalar(@$revision_ids),\n+\t\t\tprint {*STDERR} \"${n}/\", scalar(@$revision_ids),\n \t\t\t\t\": Skipping revision #$rev->{revid} of ${page_title}\\n\";\n \t\t\tnext;\n \t\t}\n@@ -939,7 +939,7 @@ sub mw_import_revids {\n \t\t# If this is a revision of the media page for new version\n \t\t# of a file do one common commit for both file and media page.\n \t\t# Else do commit only for that page.\n-\t\tprint STDERR \"${n}/\", scalar(@$revision_ids), \": Revision #$rev->{revid} of $commit{title}\\n\";\n+\t\tprint {*STDERR} \"${n}/\", scalar(@$revision_ids), \": Revision #$rev->{revid} of $commit{title}\\n\";\n \t\timport_file_revision(\\%commit, ($fetch_from == 1), $n_actual, \\%mediafile);\n \t}\n \n@@ -953,11 +953,11 @@ sub error_non_fast_forward {\n \t\t# Native git-push would show this after the summary.\n \t\t# We can't ask it to display it cleanly, so print it\n \t\t# ourselves before.\n-\t\tprint STDERR \"To prevent you from losing history, non-fast-forward updates were rejected\\n\";\n-\t\tprint STDERR \"Merge the remote changes (e.g. 'git pull') before pushing again. See the\\n\";\n-\t\tprint STDERR \"'Note about fast-forwards' section of 'git push --help' for details.\\n\";\n+\t\tprint {*STDERR} \"To prevent you from losing history, non-fast-forward updates were rejected\\n\";\n+\t\tprint {*STDERR} \"Merge the remote changes (e.g. 'git pull') before pushing again. See the\\n\";\n+\t\tprint {*STDERR} \"'Note about fast-forwards' section of 'git push --help' for details.\\n\";\n \t}\n-\tprint STDOUT qq(error $_[0] \"non-fast-forward\"\\n);\n+\tprint {*STDOUT} qq(error $_[0] \"non-fast-forward\"\\n);\n \treturn 0;\n }\n \n@@ -971,8 +971,8 @@ sub mw_upload_file {\n \tmy $path = \"File:${complete_file_name}\";\n \tmy %hashFiles = get_allowed_file_extensions();\n \tif (!exists($hashFiles{$extension})) {\n-\t\tprint STDERR \"${complete_file_name} is not a permitted file on this wiki.\\n\";\n-\t\tprint STDERR \"Check the configuration of file uploads in your mediawiki.\\n\";\n+\t\tprint {*STDERR} \"${complete_file_name} is not a permitted file on this wiki.\\n\";\n+\t\tprint {*STDERR} \"Check the configuration of file uploads in your mediawiki.\\n\";\n \t\treturn $newrevid;\n \t}\n \t# Deleting and uploading a file requires a priviledged user\n@@ -984,9 +984,9 @@ sub mw_upload_file {\n \t\t\treason => $summary\n \t\t};\n \t\tif (!$mediawiki->edit($query)) {\n-\t\t\tprint STDERR \"Failed to delete file on remote wiki\\n\";\n-\t\t\tprint STDERR \"Check your permissions on the remote site. Error code:\\n\";\n-\t\t\tprint STDERR $mediawiki->{error}->{code} . ':' . $mediawiki->{error}->{details};\n+\t\t\tprint {*STDERR} \"Failed to delete file on remote wiki\\n\";\n+\t\t\tprint {*STDERR} \"Check your permissions on the remote site. Error code:\\n\";\n+\t\t\tprint {*STDERR} $mediawiki->{error}->{code} . ':' . $mediawiki->{error}->{details};\n \t\t\texit 1;\n \t\t}\n \t} else {\n@@ -1010,9 +1010,9 @@ sub mw_upload_file {\n \t\t\t\t . $mediawiki->{error}->{details} . \"\\n\";\n \t\t\tmy $last_file_page = $mediawiki->get_page({title => $path});\n \t\t\t$newrevid = $last_file_page->{revid};\n-\t\t\tprint STDERR \"Pushed file: ${new_sha1} - ${complete_file_name}.\\n\";\n+\t\t\tprint {*STDERR} \"Pushed file: ${new_sha1} - ${complete_file_name}.\\n\";\n \t\t} else {\n-\t\t\tprint STDERR \"Empty file ${complete_file_name} not pushed.\\n\";\n+\t\t\tprint {*STDERR} \"Empty file ${complete_file_name} not pushed.\\n\";\n \t\t}\n \t}\n \treturn $newrevid;\n@@ -1050,7 +1050,7 @@ sub mw_push_file {\n \tif ($extension eq 'mw') {\n \t\tmy $ns = get_mw_namespace_id_for_page($complete_file_name);\n \t\tif ($ns && $ns == get_mw_namespace_id('File') && (!$export_media)) {\n-\t\t\tprint STDERR \"Ignoring media file related page: ${complete_file_name}\\n\";\n+\t\t\tprint {*STDERR} \"Ignoring media file related page: ${complete_file_name}\\n\";\n \t\t\treturn ($oldrevid, 'ok');\n \t\t}\n \t\tmy $file_content;\n@@ -1078,7 +1078,7 @@ sub mw_push_file {\n \t\tif (!$result) {\n \t\t\tif ($mediawiki->{error}->{code} == 3) {\n \t\t\t\t# edit conflicts, considered as non-fast-forward\n-\t\t\t\tprint STDERR 'Warning: Error ' .\n+\t\t\t\tprint {*STDERR} 'Warning: Error ' .\n \t\t\t\t    $mediawiki->{error}->{code} .\n \t\t\t\t    ' from mediwiki: ' . $mediawiki->{error}->{details} .\n \t\t\t\t    \".\\n\";\n@@ -1091,13 +1091,13 @@ sub mw_push_file {\n \t\t\t}\n \t\t}\n \t\t$newrevid = $result->{edit}->{newrevid};\n-\t\tprint STDERR \"Pushed file: ${new_sha1} - ${title}\\n\";\n+\t\tprint {*STDERR} \"Pushed file: ${new_sha1} - ${title}\\n\";\n \t} elsif ($export_media) {\n \t\t$newrevid = mw_upload_file($complete_file_name, $new_sha1,\n \t\t\t\t\t   $extension, $page_deleted,\n \t\t\t\t\t   $summary);\n \t} else {\n-\t\tprint STDERR \"Ignoring media file ${title}\\n\";\n+\t\tprint {*STDERR} \"Ignoring media file ${title}\\n\";\n \t}\n \t$newrevid = ($newrevid or $oldrevid);\n \treturn ($newrevid, 'ok');\n@@ -1111,16 +1111,16 @@ sub mw_push {\n \t\tmy ($force, $local, $remote) = $refspec =~ /^(\\+)?([^:]*):([^:]*)$/\n \t\t    or die(\"Invalid refspec for push. Expected <src>:<dst> or +<src>:<dst>\\n\");\n \t\tif ($force) {\n-\t\t\tprint STDERR \"Warning: forced push not allowed on a MediaWiki.\\n\";\n+\t\t\tprint {*STDERR} \"Warning: forced push not allowed on a MediaWiki.\\n\";\n \t\t}\n \t\tif ($local eq \"\") {\n-\t\t\tprint STDERR \"Cannot delete remote branch on a MediaWiki\\n\";\n-\t\t\tprint STDOUT \"error ${remote} cannot delete\\n\";\n+\t\t\tprint {*STDERR} \"Cannot delete remote branch on a MediaWiki\\n\";\n+\t\t\tprint {*STDOUT} \"error ${remote} cannot delete\\n\";\n \t\t\tnext;\n \t\t}\n \t\tif ($remote ne 'refs/heads/master') {\n-\t\t\tprint STDERR \"Only push to the branch 'master' is supported on a MediaWiki\\n\";\n-\t\t\tprint STDOUT \"error ${remote} only master allowed\\n\";\n+\t\t\tprint {*STDERR} \"Only push to the branch 'master' is supported on a MediaWiki\\n\";\n+\t\t\tprint {*STDOUT} \"error ${remote} only master allowed\\n\";\n \t\t\tnext;\n \t\t}\n \t\tif (mw_push_revision($local, $remote)) {\n@@ -1129,15 +1129,15 @@ sub mw_push {\n \t}\n \n \t# Notify Git that the push is done\n-\tprint STDOUT \"\\n\";\n+\tprint {*STDOUT} \"\\n\";\n \n \tif ($pushed && $dumb_push) {\n-\t\tprint STDERR \"Just pushed some revisions to MediaWiki.\\n\";\n-\t\tprint STDERR \"The pushed revisions now have to be re-imported, and your current branch\\n\";\n-\t\tprint STDERR \"needs to be updated with these re-imported commits. You can do this with\\n\";\n-\t\tprint STDERR \"\\n\";\n-\t\tprint STDERR \"  git pull --rebase\\n\";\n-\t\tprint STDERR \"\\n\";\n+\t\tprint {*STDERR} \"Just pushed some revisions to MediaWiki.\\n\";\n+\t\tprint {*STDERR} \"The pushed revisions now have to be re-imported, and your current branch\\n\";\n+\t\tprint {*STDERR} \"needs to be updated with these re-imported commits. You can do this with\\n\";\n+\t\tprint {*STDERR} \"\\n\";\n+\t\tprint {*STDERR} \"  git pull --rebase\\n\";\n+\t\tprint {*STDERR} \"\\n\";\n \t}\n \treturn;\n }\n@@ -1146,7 +1146,7 @@ sub mw_push_revision {\n \tmy $local = shift;\n \tmy $remote = shift; # actually, this has to be \"refs/heads/master\" at this point.\n \tmy $last_local_revid = get_last_local_revision();\n-\tprint STDERR \".\\n\"; # Finish sentence started by get_last_local_revision()\n+\tprint {*STDERR} \".\\n\"; # Finish sentence started by get_last_local_revision()\n \tmy $last_remote_revid = get_last_remote_revision();\n \tmy $mw_revision = $last_remote_revid;\n \n@@ -1173,7 +1173,7 @@ sub mw_push_revision {\n \tif ($last_local_revid > 0) {\n \t\tmy $parsed_sha1 = $remoteorigin_sha1;\n \t\t# Find a path from last MediaWiki commit to pushed commit\n-\t\tprint STDERR \"Computing path from local to remote ...\\n\";\n+\t\tprint {*STDERR} \"Computing path from local to remote ...\\n\";\n \t\tmy @local_ancestry = split(/\\n/, run_git(\"rev-list --boundary --parents ${local} ^${parsed_sha1}\"));\n \t\tmy %local_ancestry;\n \t\tforeach my $line (@local_ancestry) {\n@@ -1188,7 +1188,7 @@ sub mw_push_revision {\n \t\twhile ($parsed_sha1 ne $HEAD_sha1) {\n \t\t\tmy $child = $local_ancestry{$parsed_sha1};\n \t\t\tif (!$child) {\n-\t\t\t\tprintf STDERR \"Cannot find a path in history from remote commit to last commit\\n\";\n+\t\t\t\tprint {*STDERR} \"Cannot find a path in history from remote commit to last commit\\n\";\n \t\t\t\treturn error_non_fast_forward($remote);\n \t\t\t}\n \t\t\tpush(@commit_pairs, [$parsed_sha1, $child]);\n@@ -1197,7 +1197,7 @@ sub mw_push_revision {\n \t} else {\n \t\t# No remote mediawiki revision. Export the whole\n \t\t# history (linearized with --first-parent)\n-\t\tprint STDERR \"Warning: no common ancestor, pushing complete history\\n\";\n+\t\tprint {*STDERR} \"Warning: no common ancestor, pushing complete history\\n\";\n \t\tmy $history = run_git(\"rev-list --first-parent --children ${local}\");\n \t\tmy @history = split(/\\n/, $history);\n \t\t@history = @history[1..$#history];\n@@ -1245,7 +1245,7 @@ sub mw_push_revision {\n \t\t}\n \t}\n \n-\tprint STDOUT \"ok ${remote}\\n\";\n+\tprint {*STDOUT} \"ok ${remote}\\n\";\n \treturn 1;\n }\n \n@@ -1296,7 +1296,7 @@ sub get_mw_namespace_id {\n \t}\n \n \tif (!exists $namespace_id{$name}) {\n-\t\tprint STDERR \"Namespace ${name} not found in cache, querying the wiki ...\\n\";\n+\t\tprint {*STDERR} \"Namespace ${name} not found in cache, querying the wiki ...\\n\";\n \t\t# NS not found => get namespace id from MW and store it in\n \t        # configuration file.\n \t        my $query = {\n@@ -1321,7 +1321,7 @@ sub get_mw_namespace_id {\n \tmy $id;\n \n \tunless (defined $ns) {\n-\t\tprint STDERR \"No such namespace ${name} on MediaWiki.\\n\";\n+\t\tprint {*STDERR} \"No such namespace ${name} on MediaWiki.\\n\";\n \t\t$ns = {is_namespace => 0};\n \t\t$namespace_id{$name} = $ns;\n \t}\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220630","messageId":"1371051828-12866-25-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 24/31] git-remote-mediawiki: Replace \"unless\" statements with negated \"if\" statements","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:41Z","receivedAt":"2013-06-12T15:43:41Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 8b0144c..3f04d14 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -86,11 +86,11 @@ $shallow_import = ($shallow_import eq 'true');\n # - by_rev: perform one query per new revision on the remote wiki\n # - by_page: query each tracked page for new revision\n my $fetch_strategy = run_git(\"config --get remote.${remotename}.fetchStrategy\");\n-unless ($fetch_strategy) {\n+if (!$fetch_strategy) {\n \t$fetch_strategy = run_git('config --get mediawiki.fetchStrategy');\n }\n chomp($fetch_strategy);\n-unless ($fetch_strategy) {\n+if (!$fetch_strategy) {\n \t$fetch_strategy = 'by_page';\n }\n \n@@ -112,7 +112,7 @@ my %basetimestamps;\n # deterministic, this means everybody gets the same sha1 for each\n # MediaWiki revision.\n my $dumb_push = run_git(\"config --get --bool remote.${remotename}.dumbPush\");\n-unless ($dumb_push) {\n+if (!$dumb_push) {\n \t$dumb_push = run_git('config --get --bool mediawiki.dumbPush');\n }\n chomp($dumb_push);\n@@ -667,7 +667,7 @@ sub fetch_mw_revisions_for_page {\n \t\t\tpush(@page_revs, $page_rev_ids);\n \t\t\t$revnum++;\n \t\t}\n-\t\tlast unless $result->{'query-continue'};\n+\t\tlast if (!$result->{'query-continue'});\n \t\t$query->{rvstartid} = $result->{'query-continue'}->{revisions}->{rvstartid};\n \t}\n \tif ($shallow_import && @page_revs) {\n@@ -1239,7 +1239,7 @@ sub mw_push_revision {\n \t\t\t\tdie(\"Unknown error from mw_push_file()\\n\");\n \t\t\t}\n \t\t}\n-\t\tunless ($dumb_push) {\n+\t\tif (!$dumb_push) {\n \t\t\trun_git(qq(notes --ref=${remotename}/mediawiki add -f -m \"mediawiki_revision: ${mw_revision}\" ${sha1_commit}));\n \t\t\trun_git(qq(update-ref -m \"Git-MediaWiki push\" refs/mediawiki/${remotename}/master ${sha1_commit} ${sha1_child}));\n \t\t}\n@@ -1320,7 +1320,7 @@ sub get_mw_namespace_id {\n \tmy $ns = $namespace_id{$name};\n \tmy $id;\n \n-\tunless (defined $ns) {\n+\tif (!defined $ns) {\n \t\tprint {*STDERR} \"No such namespace ${name} on MediaWiki.\\n\";\n \t\t$ns = {is_namespace => 0};\n \t\t$namespace_id{$name} = $ns;\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220621","messageId":"1371051828-12866-26-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 25/31] git-remote-mediawiki: Don't use quotes for empty strings","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:42Z","receivedAt":"2013-06-12T15:43:42Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Empty strings are replaced by an $EMPTY constant.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 18 ++++++++++--------\n 1 file changed, 10 insertions(+), 8 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 3f04d14..209dbe1 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -40,6 +40,8 @@ use constant NULL_SHA1 => '0000000000000000000000000000000000000000';\n # Used on Git's side to reflect empty edit messages on the wiki\n use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n \n+use constant EMPTY => q{};\n+\n if (@ARGV != 2) {\n \texit_error_usage();\n }\n@@ -160,11 +162,11 @@ sub parse_command {\n \t\tmw_list($cmd[1]);\n \t} elsif ($cmd[0] eq 'import') {\n \t\tdie(\"Invalid arguments for import\\n\")\n-\t\t    if ($cmd[1] eq \"\" || defined($cmd[2]));\n+\t\t    if ($cmd[1] eq EMPTY || defined($cmd[2]));\n \t\tmw_import($cmd[1]);\n \t} elsif ($cmd[0] eq 'option') {\n \t\tdie(\"Too many arguments for option\\n\")\n-\t\t    if ($cmd[1] eq \"\" || $cmd[2] eq \"\" || defined($cmd[3]));\n+\t\t    if ($cmd[1] eq EMPTY || $cmd[2] eq EMPTY || defined($cmd[3]));\n \t\tmw_option($cmd[1],$cmd[2]);\n \t} elsif ($cmd[0] eq 'push') {\n \t\tmw_push($cmd[1]);\n@@ -555,7 +557,7 @@ sub mediawiki_clean {\n \t# Mediawiki does not allow blank space at the end of a page and ends with a single \\n.\n \t# This function right trims a string and adds a \\n at the end to follow this rule\n \t$string =~ s/\\s+$//;\n-\tif ($string eq \"\" && $page_created) {\n+\tif ($string eq EMPTY && $page_created) {\n \t\t# Creating empty pages is forbidden.\n \t\t$string = EMPTY_CONTENT;\n \t}\n@@ -566,7 +568,7 @@ sub mediawiki_clean {\n sub mediawiki_smudge {\n \tmy $string = shift;\n \tif ($string eq EMPTY_CONTENT) {\n-\t\t$string = \"\";\n+\t\t$string = EMPTY;\n \t}\n \t# This \\n is important. This is due to mediawiki's way to handle end of files.\n \treturn \"${string}\\n\";\n@@ -992,7 +994,7 @@ sub mw_upload_file {\n \t} else {\n \t\t# Don't let perl try to interpret file content as UTF-8 => use \"raw\"\n \t\tmy $content = run_git(\"cat-file blob ${new_sha1}\", 'raw');\n-\t\tif ($content ne \"\") {\n+\t\tif ($content ne EMPTY) {\n \t\t\tmw_connect_maybe();\n \t\t\t$mediawiki->{config}->{upload_url} =\n \t\t\t\t\"${url}/index.php/Special:Upload\";\n@@ -1034,7 +1036,7 @@ sub mw_push_file {\n \tmy $newrevid;\n \n \tif ($summary eq EMPTY_MESSAGE) {\n-\t\t$summary = '';\n+\t\t$summary = EMPTY;\n \t}\n \n \tmy $new_sha1 = $diff_info_split[3];\n@@ -1045,7 +1047,7 @@ sub mw_push_file {\n \n \tmy ($title, $extension) = $complete_file_name =~ /^(.*)\\.([^\\.]*)$/;\n \tif (!defined($extension)) {\n-\t\t$extension = \"\";\n+\t\t$extension = EMPTY;\n \t}\n \tif ($extension eq 'mw') {\n \t\tmy $ns = get_mw_namespace_id_for_page($complete_file_name);\n@@ -1113,7 +1115,7 @@ sub mw_push {\n \t\tif ($force) {\n \t\t\tprint {*STDERR} \"Warning: forced push not allowed on a MediaWiki.\\n\";\n \t\t}\n-\t\tif ($local eq \"\") {\n+\t\tif ($local eq EMPTY) {\n \t\t\tprint {*STDERR} \"Cannot delete remote branch on a MediaWiki\\n\";\n \t\t\tprint {*STDOUT} \"error ${remote} cannot delete\\n\";\n \t\t\tnext;\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220622","messageId":"1371051828-12866-27-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 26/31] git-remote-mediawiki: Put non-trivial numeric values in constants.","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:43Z","receivedAt":"2013-06-12T15:43:43Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Non-trivial numeric values (e.g., different from 0, 1 and 2) are placed in\nconstants at the top of the code to be easily modifiable and to make more sense\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 20 ++++++++++++++------\n 1 file changed, 14 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 209dbe1..f4a63fb 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -42,6 +42,16 @@ use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n \n use constant EMPTY => q{};\n \n+# Number of pages taken into account at once in submodule get_mw_page_list\n+use constant SLICE_SIZE => 50;\n+\n+# Number of linked mediafile to get at once in get_linked_mediafiles\n+# The query is split in small batches because of the MW API limit of\n+# the number of links to be returned (500 links max).\n+use constant BATCH_SIZE => 10;\n+\n+use constant HTTP_CODE_OK => 200;\n+\n if (@ARGV != 2) {\n \texit_error_usage();\n }\n@@ -223,13 +233,13 @@ sub get_mw_page_list {\n \tmy $pages = shift;\n \tmy @some_pages = @$page_list;\n \twhile (@some_pages) {\n-\t\tmy $last_page = 50;\n+\t\tmy $last_page = SLICE_SIZE;\n \t\tif ($#some_pages < $last_page) {\n \t\t\t$last_page = $#some_pages;\n \t\t}\n \t\tmy @slice = @some_pages[0..$last_page];\n \t\tget_mw_first_pages(\\@slice, $pages);\n-\t\t@some_pages = @some_pages[51..$#some_pages];\n+\t\t@some_pages = @some_pages[(SLICE_SIZE + 1)..$#some_pages];\n \t}\n \treturn;\n }\n@@ -385,9 +395,7 @@ sub get_linked_mediafiles {\n \tmy $pages = shift;\n \tmy @titles = map { $_->{title} } values(%{$pages});\n \n-\t# The query is split in small batches because of the MW API limit of\n-\t# the number of links to be returned (500 links max).\n-\tmy $batch = 10;\n+\tmy $batch = BATCH_SIZE;\n \twhile (@titles) {\n \t\tif ($#titles < $batch) {\n \t\t\t$batch = $#titles;\n@@ -469,7 +477,7 @@ sub download_mw_mediafile {\n \tmy $download_url = shift;\n \n \tmy $response = $mediawiki->{ua}->get($download_url);\n-\tif ($response->code == 200) {\n+\tif ($response->code == HTTP_CODE_OK) {\n \t\treturn $response->decoded_content;\n \t} else {\n \t\tprint {*STDERR} \"Error downloading mediafile from :\\n\";\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220619","messageId":"1371051828-12866-28-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 27/31] git-remote-mediawiki: Fix a typo (\"mediwiki\" instead of \"mediawiki\")","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:44Z","receivedAt":"2013-06-12T15:43:44Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex f4a63fb..fa24eb1 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1090,14 +1090,14 @@ sub mw_push_file {\n \t\t\t\t# edit conflicts, considered as non-fast-forward\n \t\t\t\tprint {*STDERR} 'Warning: Error ' .\n \t\t\t\t    $mediawiki->{error}->{code} .\n-\t\t\t\t    ' from mediwiki: ' . $mediawiki->{error}->{details} .\n+\t\t\t\t    ' from mediawiki: ' . $mediawiki->{error}->{details} .\n \t\t\t\t    \".\\n\";\n \t\t\t\treturn ($oldrevid, 'non-fast-forward');\n \t\t\t} else {\n \t\t\t\t# Other errors. Shouldn't happen => just die()\n \t\t\t\tdie 'Fatal: Error ' .\n \t\t\t\t    $mediawiki->{error}->{code} .\n-\t\t\t\t    ' from mediwiki: ' . $mediawiki->{error}->{details} . \"\\n\";\n+\t\t\t\t    ' from mediawiki: ' . $mediawiki->{error}->{details} . \"\\n\";\n \t\t\t}\n \t\t}\n \t\t$newrevid = $result->{edit}->{newrevid};\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220623","messageId":"1371051828-12866-29-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 28/31] git-remote-mediawiki: Clearly rewrite double dereference","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:45Z","receivedAt":"2013-06-12T15:43:45Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"@$var structures are re-written in the following way: @{$var}\nIt makes them more readable.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex fa24eb1..d839154 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -231,7 +231,7 @@ sub get_mw_tracked_pages {\n sub get_mw_page_list {\n \tmy $page_list = shift;\n \tmy $pages = shift;\n-\tmy @some_pages = @$page_list;\n+\tmy @some_pages = @{$page_list};\n \twhile (@some_pages) {\n \t\tmy $last_page = SLICE_SIZE;\n \t\tif ($#some_pages < $last_page) {\n@@ -881,7 +881,7 @@ sub mw_import_revids {\n \tmy $n_actual = 0;\n \tmy $last_timestamp = 0; # Placeholer in case $rev->timestamp is undefined\n \n-\tforeach my $pagerevid (@$revision_ids) {\n+\tforeach my $pagerevid (@{$revision_ids}) {\n \t        # Count page even if we skip it, since we display\n \t\t# $n/$total and $total includes skipped pages.\n \t\t$n++;\n@@ -916,7 +916,7 @@ sub mw_import_revids {\n \t\tmy $page_title = $result_page->{title};\n \n \t\tif (!exists($pages->{$page_title})) {\n-\t\t\tprint {*STDERR} \"${n}/\", scalar(@$revision_ids),\n+\t\t\tprint {*STDERR} \"${n}/\", scalar(@{$revision_ids}),\n \t\t\t\t\": Skipping revision #$rev->{revid} of ${page_title}\\n\";\n \t\t\tnext;\n \t\t}\n@@ -949,7 +949,7 @@ sub mw_import_revids {\n \t\t# If this is a revision of the media page for new version\n \t\t# of a file do one common commit for both file and media page.\n \t\t# Else do commit only for that page.\n-\t\tprint {*STDERR} \"${n}/\", scalar(@$revision_ids), \": Revision #$rev->{revid} of $commit{title}\\n\";\n+\t\tprint {*STDERR} \"${n}/\", scalar(@{$revision_ids}), \": Revision #$rev->{revid} of $commit{title}\\n\";\n \t\timport_file_revision(\\%commit, ($fetch_from == 1), $n_actual, \\%mediafile);\n \t}\n \n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220620","messageId":"1371051828-12866-30-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 29/31] git-remote-mediawiki: Add a .perlcriticrc file","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:46Z","receivedAt":"2013-06-12T15:43:46Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Such a file allows to configure perlcritic.\nHere, it is used to remove many unwanted rules and configure one to\nremove unwanted warnings.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/.perlcriticrc | 28 ++++++++++++++++++++++++++++\n 1 file changed, 28 insertions(+)\n create mode 100644 contrib/mw-to-git/.perlcriticrc\n\ndiff --git a/contrib/mw-to-git/.perlcriticrc b/contrib/mw-to-git/.perlcriticrc\nnew file mode 100644\nindex 0000000..5a9955d\n--- /dev/null\n+++ b/contrib/mw-to-git/.perlcriticrc\n@@ -0,0 +1,28 @@\n+# These 3 rules demand to add the s, m and x flag to *every* regexp. This is\n+# overkill and would be harmful for readability.\n+[-RegularExpressions::RequireExtendedFormatting]\n+[-RegularExpressions::RequireDotMatchAnything]\n+[-RegularExpressions::RequireLineBoundaryMatching]\n+\n+# This rule says that builtin functions should not be called with parentheses\n+# e.g.: (taken from CPAN's documentation)\n+# open($handle, '>', $filename); #not ok\n+# open $handle, '>', $filename;  #ok\n+# Applying such a rule would mean modifying a huge number of lines for a\n+# question of style.\n+[-CodeLayout::ProhibitParensWithBuiltins]\n+\n+# This rule states that each system call should have its return value checked\n+# The problem is that it includes the print call. Checking every print call's\n+# return value would be harmful to the code readabilty.\n+# This configuration keeps all default function but print.\n+[InputOutput::RequireCheckedSyscalls]\n+functions = open say close\n+\n+# This rules demands to add a dependancy for the Readonly module. This is not\n+# wished.\n+[-ValuesAndExpressions::ProhibitConstantPragma]\n+\n+# This rule is not really useful (rather a question of style) and produces many\n+# warnings among the code.\n+[-ValuesAndExpressions::ProhibitNoisyQuotes]\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220632","messageId":"1371051828-12866-31-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 30/31] git-remote-mediawiki: add a perlcritic rule in Makefile","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:47Z","receivedAt":"2013-06-12T15:43:47Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Option \"-2\" launches perlcritic with level 2. Levels go from 5 (most pertinent)\nto 1. Rules of level 1 are mostly a question of style, and are therefore\nignored.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/Makefile | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile\nindex 8976aa3..e08b19f 100644\n--- a/contrib/mw-to-git/Makefile\n+++ b/contrib/mw-to-git/Makefile\n@@ -18,4 +18,7 @@ build install clean:\n \t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_FULL) \\\n                 $@-perl-script\n \t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=$(SCRIPT_PERL_PREVIEW_FULL) \\\n-                $@-perl-script\n\\ No newline at end of file\n+                $@-perl-script\n+\n+perlcritic:\n+\tperlcritic -2 *.perl\n\\ No newline at end of file\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220628","messageId":"1371051828-12866-32-git-send-email-celestin.matte@ensimag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v5 31/31] git-remote-mediawiki: Make error message more precise","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T15:43:48Z","receivedAt":"2013-06-12T15:43:48Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"In subroutine parse_command, error messages were not correct. For the \"import\"\nfunction, having too much or incorrect arguments displayed both\n\"invalid arguments\", while it displayed \"too many arguments\" for the \"option\"\nfunctions under the same conditions.\nSeparate the two error messages in both cases.\n\nSigned-off-by: Célestin Matte <celestin.matte@ensimag.fr>\nSigned-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki.perl | 10 +++++++---\n 1 file changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex d839154..a20a588 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -171,12 +171,16 @@ sub parse_command {\n \t\tdie(\"Too many arguments for list\\n\") if (defined($cmd[2]));\n \t\tmw_list($cmd[1]);\n \t} elsif ($cmd[0] eq 'import') {\n-\t\tdie(\"Invalid arguments for import\\n\")\n-\t\t    if ($cmd[1] eq EMPTY || defined($cmd[2]));\n+\t\tdie(\"Invalid argument for import\\n\")\n+\t\t    if ($cmd[1] eq EMPTY);\n+\t\tdie(\"Too many arguments for import\\n\")\n+\t\t    if (defined($cmd[2]));\n \t\tmw_import($cmd[1]);\n \t} elsif ($cmd[0] eq 'option') {\n+\t\tdie(\"Invalid arguments for option\\n\")\n+\t\t    if ($cmd[1] eq EMPTY || $cmd[2] eq EMPTY);\n \t\tdie(\"Too many arguments for option\\n\")\n-\t\t    if ($cmd[1] eq EMPTY || $cmd[2] eq EMPTY || defined($cmd[3]));\n+\t\t    if (defined($cmd[3]));\n \t\tmw_option($cmd[1],$cmd[2]);\n \t} elsif ($cmd[0] eq 'push') {\n \t\tmw_push($cmd[1]);\n-- \n1.8.3.rc3.18.g21a7b2c\n"},{"id":"220667","messageId":"vpqd2rrqeqg.fsf@anie.imag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-06-12T20:02:47Z","receivedAt":"2013-06-12T20:02:47Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Célestin Matte <celestin.matte@ensimag.fr> writes:\n\n> Not many changes since v3. This version is only for fixing last typos and\n> applying Junio's recommandations for [21/31], which I forgot in v4.\n> At this point, the only patch worth reviewing is [21/31].\n\nThanks. I went through the series again and it all looks good.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"220669","messageId":"51B8DB5E.8030707@ensimag.fr","threadId":"34115","inReplyTo":"vpqd2rrqeqg.fsf@anie.imag.fr","subject":"Re: [PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T20:34:38Z","receivedAt":"2013-06-12T20:34:38Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 12/06/2013 22:02, Matthieu Moy a écrit :\n> Célestin Matte <celestin.matte@ensimag.fr> writes:\n> \n>> Not many changes since v3. This version is only for fixing last typos and\n>> applying Junio's recommandations for [21/31], which I forgot in v4.\n>> At this point, the only patch worth reviewing is [21/31].\n> \n> Thanks. I went through the series again and it all looks good.\n> \n\nActually, there still is a problem: the \"defined(@array)\" (introduced\nwith the change in [21/31]) produces a warning.\nBenoit also seems to have problems with this patch... I'm waiting for\nhis feedback.\n\n-- \nCélestin Matte\n"},{"id":"220670","messageId":"51B8DE57.9040205@ensimag.fr","threadId":"34115","inReplyTo":"51B8DB5E.8030707@ensimag.fr","subject":"Re: [PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T20:47:19Z","receivedAt":"2013-06-12T20:47:19Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 12/06/2013 22:34, Célestin Matte a écrit :\n> Le 12/06/2013 22:02, Matthieu Moy a écrit :\n>> Célestin Matte <celestin.matte@ensimag.fr> writes:\n>>\n>>> Not many changes since v3. This version is only for fixing last typos and\n>>> applying Junio's recommandations for [21/31], which I forgot in v4.\n>>> At this point, the only patch worth reviewing is [21/31].\n>>\n>> Thanks. I went through the series again and it all looks good.\n>>\n> \n> Actually, there still is a problem: the \"defined(@array)\" (introduced\n> with the change in [21/31]) produces a warning.\n> Benoit also seems to have problems with this patch... I'm waiting for\n> his feedback.\n> \nThere is indeed a bug. In patch [21/31], at line 163, it should be\nif (!defined $cmd[0]) {\ninstead of\nif (!defined @cmd) {\n.\n\nShould I send yet another version of this series of patch?\n\n-- \nCélestin Matte\n"},{"id":"220675","messageId":"vpqr4g7owyi.fsf@anie.imag.fr","threadId":"34115","inReplyTo":"1371051828-12866-1-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-06-12T21:12:05Z","receivedAt":"2013-06-12T21:12:05Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Which commit is this based on?\n\n\"git am\" fails, whether I try from Junio's master, next or pu. My best\ntry was from da608b124c76f8f7dba8a9d8f0bc8174b9744176. It seems you're\nbased on a local commit which doesn't exist on Junio's end.\n\nMost commit in-flight are in next, so I guess rebasing the series on\nnext would make it easier for Junio (we normally send patches against\nmaster as much as possible, see SubmittingPatches for more details).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"220676","messageId":"51B8E50E.9070202@ensimag.fr","threadId":"34115","inReplyTo":"vpqr4g7owyi.fsf@anie.imag.fr","subject":"Re: [PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-12T21:15:58Z","receivedAt":"2013-06-12T21:15:58Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 12/06/2013 23:12, Matthieu Moy a écrit :\n> Which commit is this based on?\n> \n> \"git am\" fails, whether I try from Junio's master, next or pu. My best\n> try was from da608b124c76f8f7dba8a9d8f0bc8174b9744176. It seems you're\n> based on a local commit which doesn't exist on Junio's end.\n\nIndeed, we worked on branch master of a common repository before\nstarting doing things properly. :/\n\n> Most commit in-flight are in next, so I guess rebasing the series on\n> next would make it easier for Junio (we normally send patches against\n> master as much as possible, see SubmittingPatches for more details).\n\nI will try to do this.\n\n\n-- \nCélestin Matte\n"},{"id":"220677","messageId":"CAPig+cRg4so7W+ddgGg7_ZnKNkoc0T8CqNQOO5a7xnjN1LYvzw@mail.gmail.com","threadId":"34115","inReplyTo":"51B8DE57.9040205@ensimag.fr","subject":"Re: [PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-12T21:23:57Z","receivedAt":"2013-06-12T21:23:57Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Jun 12, 2013 at 4:47 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> Le 12/06/2013 22:34, Célestin Matte a écrit :\n>>> Célestin Matte <celestin.matte@ensimag.fr> writes:\n>> Actually, there still is a problem: the \"defined(@array)\" (introduced\n>> with the change in [21/31]) produces a warning.\n>> Benoit also seems to have problems with this patch... I'm waiting for\n>> his feedback.\n>>\n> There is indeed a bug. In patch [21/31], at line 163, it should be\n> if (!defined $cmd[0]) {\n> instead of\n> if (!defined @cmd) {\n>\n> Should I send yet another version of this series of patch?\n\nAssuming you don't discover more problems, for such a small change in\na lengthy patch series, it might make sense to send a simple \"fixup!\"\n[*1*] patch and ask if Junio would be willing to squash it into v5.\n\n[*1*]: see fixup! in git/Documentation/git-rebase.txt\n"},{"id":"220683","messageId":"7vobbbym7s.fsf@alter.siamese.dyndns.org","threadId":"34115","inReplyTo":"vpqr4g7owyi.fsf@anie.imag.fr","subject":"Re: [PATCH v5 00/31] Follow perlcritic's recommandations","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-12T22:53:59Z","receivedAt":"2013-06-12T22:53:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Which commit is this based on?\n>\n> \"git am\" fails, whether I try from Junio's master, next or pu. My best\n> try was from da608b124c76f8f7dba8a9d8f0bc8174b9744176. It seems you're\n> based on a local commit which doesn't exist on Junio's end.\n>\n> Most commit in-flight are in next, so I guess rebasing the series on\n> next would make it easier for Junio (we normally send patches against\n> master as much as possible, see SubmittingPatches for more details).\n\nThis is why a wholesale updates like \"use sq instead of dq when we\ncan\", \"always return; from a sub\", etc. needs inter-developer\ncoordination.\n\nI agree with you that it would probably be the easiest to build this\non top of the merge bewteen master, bp/mediawiki-credential, and\nyour mm/mediawiki-https-fail-message topics.\n\nThanks.\n"}]}