{"thread":{"id":"34053","subject":"[PATCH v2 00/22] git-remote-mediawiki: Follow perlcritic's recommandations","startedAt":"2013-06-07T21:42:01Z","lastAt":"2013-06-09T04:52:44Z","messageCount":41,"participants":["Célestin Matte","Eric Sunshine","Jeff King","Benoît Person","Célestin Perdu","Matthieu Moy"],"isPatch":true,"patchVersion":2,"patchTotal":22},"messages":[{"id":"219717","messageId":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":null,"subject":"[PATCH v2 00/22] git-remote-mediawiki: Follow perlcritic's recommandations","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:01Z","receivedAt":"2013-06-07T21:42:01Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"v2 of patch to follow perlcritic's recommandations ([1])\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\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/226533\n\nCélestin Matte (22):\n  git-remote-mediawiki: Replace :utf8 by :encoding(UTF-8)\n  git-remote-mediawiki: Use the Readonly module instead of the constant\n    pragma\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: Change style of some regular expressions\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 + remove import of\n    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\n contrib/mw-to-git/git-remote-mediawiki.perl |  545 ++++++++++++++-------------\n 1 file changed, 293 insertions(+), 252 deletions(-)\n\n-- \n1.7.9.5\n"},{"id":"219719","messageId":"1370641344-4253-2-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 01/22] git-remote-mediawiki: Replace :utf8 by :encoding(UTF-8)","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:02Z","receivedAt":"2013-06-07T21:42:02Z","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 7b61e73..4893442 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@@ -588,7 +588,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.7.9.5\n"},{"id":"219737","messageId":"1370641344-4253-3-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 02/22] git-remote-mediawiki: Use the Readonly module instead of the constant pragma","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:03Z","receivedAt":"2013-06-07T21:42:03Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Follow ValuesAndExpressions::ProhibitConstantPragma\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 |   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 4893442..e60793a 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -26,21 +26,21 @@ use IPC::Open2;\n use Readonly;\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+Readonly my $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-use constant DELETED_CONTENT => \"[[Category:Deleted]]\\n\";\n+Readonly my $DELETED_CONTENT => \"[[Category:Deleted]]\\n\";\n \n # It's not possible to create empty pages. New empty files in Git are\n # sent with this content instead.\n-use constant EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n+Readonly my $EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n \n # used to reflect file creation or deletion in diff.\n-use constant NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n+Readonly my $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+Readonly my $EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n \n if (@ARGV != 2) {\n \texit_error_usage();\n@@ -538,7 +538,7 @@ sub mediawiki_clean {\n \t$string =~ s/\\s+$//;\n \tif ($string eq \"\" && $page_created) {\n \t\t# Creating empty pages is forbidden.\n-\t\t$string = EMPTY_CONTENT;\n+\t\t$string = $EMPTY_CONTENT;\n \t}\n \treturn $string.\"\\n\";\n }\n@@ -546,7 +546,7 @@ sub mediawiki_clean {\n # Filter applied on MediaWiki data before adding them to Git\n sub mediawiki_smudge {\n \tmy $string = shift;\n-\tif ($string eq EMPTY_CONTENT) {\n+\tif ($string eq $EMPTY_CONTENT) {\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@@ -707,7 +707,7 @@ sub import_file_revision {\n \tif (!$full_import && $n == 1) {\n \t\tprint STDOUT \"from refs/mediawiki/$remotename/master^0\\n\";\n \t}\n-\tif ($content ne DELETED_CONTENT) {\n+\tif ($content ne $DELETED_CONTENT) {\n \t\tprint STDOUT \"M 644 inline \" .\n \t\t    fe_escape_path($title . \".mw\") . \"\\n\";\n \t\tliteral_data($content);\n@@ -888,7 +888,7 @@ sub mw_import_revids {\n \n \t\tmy %commit;\n \t\t$commit{author} = $rev->{user} || 'Anonymous';\n-\t\t$commit{comment} = $rev->{comment} || EMPTY_MESSAGE;\n+\t\t$commit{comment} = $rev->{comment} || $EMPTY_MESSAGE;\n \t\t$commit{title} = mediawiki_smudge_filename($page_title);\n \t\t$commit{mw_revision} = $rev->{revid};\n \t\t$commit{content} = mediawiki_smudge($rev->{'*'});\n@@ -1006,14 +1006,14 @@ sub mw_push_file {\n \tmy $oldrevid = shift;\n \tmy $newrevid;\n \n-\tif ($summary eq EMPTY_MESSAGE) {\n+\tif ($summary eq $EMPTY_MESSAGE) {\n \t\t$summary = '';\n \t}\n \n \tmy $new_sha1 = $diff_info_split[3];\n \tmy $old_sha1 = $diff_info_split[2];\n-\tmy $page_created = ($old_sha1 eq NULL_SHA1);\n-\tmy $page_deleted = ($new_sha1 eq NULL_SHA1);\n+\tmy $page_created = ($old_sha1 eq $NULL_SHA1);\n+\tmy $page_deleted = ($new_sha1 eq $NULL_SHA1);\n \t$complete_file_name = mediawiki_clean_filename($complete_file_name);\n \n \tmy ($title, $extension) = $complete_file_name =~ /^(.*)\\.([^\\.]*)$/;\n@@ -1032,7 +1032,7 @@ sub mw_push_file {\n \t\t\t# special privileges. A common\n \t\t\t# convention is to replace the page\n \t\t\t# with this content instead:\n-\t\t\t$file_content = DELETED_CONTENT;\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}\n-- \n1.7.9.5\n"},{"id":"219738","messageId":"1370641344-4253-4-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 03/22] git-remote-mediawiki: Always end a subroutine with a return","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:04Z","receivedAt":"2013-06-07T21:42:04Z","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 e60793a..bbde9fd 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -198,12 +198,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@@ -219,6 +221,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@@ -241,6 +244,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@@ -260,6 +264,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@@ -290,6 +295,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@@ -358,6 +364,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@@ -404,6 +411,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@@ -579,6 +587,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@@ -589,6 +598,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@@ -600,6 +610,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@@ -608,11 +619,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@@ -734,6 +747,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@@ -754,6 +768,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@@ -763,6 +778,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@@ -806,6 +822,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@@ -1112,6 +1129,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.7.9.5\n"},{"id":"219739","messageId":"1370641344-4253-5-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 04/22] 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-07T21:42:05Z","receivedAt":"2013-06-07T21:42:05Z","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 bbde9fd..dc8dd1f 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -96,6 +96,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@@ -481,9 +484,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.7.9.5\n"},{"id":"219721","messageId":"1370641344-4253-6-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 05/22] git-remote-mediawiki: Change syntax of map calls","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:06Z","receivedAt":"2013-06-07T21:42:06Z","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 dc8dd1f..5e348cb 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -372,7 +372,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@@ -400,11 +400,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@@ -834,7 +836,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@@ -1247,8 +1249,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.7.9.5\n"},{"id":"219718","messageId":"1370641344-4253-7-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 06/22] git-remote-mediawiki: Rewrite unclear line of instructions","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:07Z","receivedAt":"2013-06-07T21:42:07Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Subroutines' parameters should be affected 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 5e348cb..a5c963b 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1334,7 +1334,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.7.9.5\n"},{"id":"219723","messageId":"1370641344-4253-8-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 07/22] git-remote-mediawiki: Change style of some regular expressions","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:08Z","receivedAt":"2013-06-07T21:42:08Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"- Remove m modifier when useless (m// and // was used randomly; this makes the\ncode more coherent)\n- Remove stringy split (split('c', ...) instead of split(/c/, ...))\n- Use {}{} instead of /// when slashes are used inside the regexp so as not to\nescape it.\nA \"split ' '\" is turned into a \"split / /\", which changes its behaviour: the old\nmethod matched a run of whtespaces (/\\s*/), while the new one will match a\nsingle whitespace, which is what we want 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 |   20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex a5c963b..482cd95 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -121,7 +121,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@@ -565,7 +565,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@@ -579,7 +579,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@@ -762,7 +762,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@@ -1168,11 +1168,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\t\tforeach my $parent (split(' ', $parents)) {\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@@ -1190,10 +1190,10 @@ 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+\t\t\tmy @commit_info_split = split(/[ \\n]/, $line);\n \t\t\tpush(@commit_pairs, \\@commit_info_split);\n \t\t}\n \t}\n@@ -1272,7 +1272,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.7.9.5\n"},{"id":"219734","messageId":"1370641344-4253-9-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 08/22] git-remote-mediawiki: Add newline in the end of die() error messages","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:09Z","receivedAt":"2013-06-07T21:42:09Z","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 482cd95..4baad95 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -136,16 +136,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@@ -242,7 +242,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@@ -767,7 +767,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@@ -879,7 +879,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@@ -888,7 +888,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@@ -999,7 +999,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@@ -1079,7 +1079,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@@ -1101,7 +1101,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@@ -1173,7 +1173,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@@ -1227,7 +1227,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.7.9.5\n"},{"id":"219720","messageId":"1370641344-4253-10-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 09/22] git-remote-mediawiki: Change the name of a variable","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:10Z","receivedAt":"2013-06-07T21:42:10Z","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 4baad95..68fd129 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -455,14 +455,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.7.9.5\n"},{"id":"219732","messageId":"1370641344-4253-11-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 10/22] git-remote-mediawiki: Turn double-negated expressions into simple expressions","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:11Z","receivedAt":"2013-06-07T21:42:11Z","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 68fd129..a6c7de2 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -136,16 +136,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.7.9.5\n"},{"id":"219727","messageId":"1370641344-4253-12-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 11/22] git-remote-mediawiki: Remove unused variable $entry","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:12Z","receivedAt":"2013-06-07T21:42:12Z","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 a6c7de2..cf8dfc8 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -128,7 +128,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.7.9.5\n"},{"id":"219731","messageId":"1370641344-4253-13-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 12/22] 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-07T21:42:13Z","receivedAt":"2013-06-07T21:42:13Z","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 cf8dfc8..7fbc998 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -215,11 +215,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.7.9.5\n"},{"id":"219722","messageId":"1370641344-4253-14-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 13/22] git-remote-mediawiki: Assign a variable as undef and make proper indentation","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:14Z","receivedAt":"2013-06-07T21:42:14Z","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 7fbc998..ae6dd2e 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -339,7 +339,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.7.9.5\n"},{"id":"219736","messageId":"1370641344-4253-15-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 14/22] git-remote-mediawiki: Check return value of open + remove import of unused open2","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:15Z","receivedAt":"2013-06-07T21:42:15Z","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 ae6dd2e..1c34ada 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 use Readonly;\n \n # Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced\n@@ -338,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.7.9.5\n"},{"id":"219735","messageId":"1370641344-4253-16-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 15/22] git-remote-mediawiki: Put long code into a subroutine","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:16Z","receivedAt":"2013-06-07T21:42:16Z","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 |   42 +++++++++++++++++----------\n 1 file changed, 26 insertions(+), 16 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 1c34ada..f37488b 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -133,22 +133,7 @@ while (<STDIN>) {\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\tif (parse_commands() == 1) {\n \t\t\tlast;\n \t\t}\n \t} else {\n@@ -168,6 +153,31 @@ 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_commands {\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 1;\n+\t}\n+\treturn 0;\n+}\n+\n # MediaWiki API instance, created lazily.\n my $mediawiki;\n \n-- \n1.7.9.5\n"},{"id":"219730","messageId":"1370641344-4253-17-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 16/22] git-remote-mediawiki: Modify strings for a better coding-style","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:17Z","receivedAt":"2013-06-07T21:42:17Z","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\nConflicts:\n\n\tcontrib/mw-to-git/git-remote-mediawiki.perl\n---\n contrib/mw-to-git/git-remote-mediawiki.perl |  244 +++++++++++++--------------\n 1 file changed, 121 insertions(+), 123 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex f37488b..2d4ea1d 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -18,14 +18,14 @@ 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 use Readonly;\n \n # Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced\n-Readonly my $SLASH_REPLACEMENT => \"%2F\";\n+Readonly my $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@@ -36,7 +36,7 @@ Readonly my $DELETED_CONTENT => \"[[Category:Deleted]]\\n\";\n Readonly my $EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n \n # used to reflect file creation or deletion in diff.\n-Readonly my $NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n+Readonly my $NULL_SHA1 => '0000000000000000000000000000000000000000';\n \n # Used on Git's side to reflect empty edit messages on the wiki\n Readonly my $EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n@@ -50,35 +50,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@@ -86,13 +86,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@@ -112,12 +112,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@@ -154,22 +154,22 @@ sub exit_error_usage {\n }\n \n sub parse_commands {\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@@ -186,7 +186,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@@ -199,10 +199,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@@ -242,7 +242,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@@ -268,8 +268,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@@ -295,8 +295,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@@ -346,10 +346,10 @@ 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 $res = do { \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 \t};\n@@ -367,7 +367,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@@ -404,7 +404,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@@ -442,7 +442,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@@ -473,27 +473,27 @@ 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 . \" \" . $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 \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@@ -572,7 +572,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@@ -594,13 +594,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@@ -619,7 +619,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@@ -678,7 +678,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@@ -690,8 +690,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@@ -705,7 +704,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@@ -725,41 +724,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@@ -787,7 +786,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@@ -802,7 +801,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@@ -818,15 +817,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@@ -900,7 +899,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@@ -910,8 +909,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@@ -936,14 +935,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@@ -951,9 +950,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@@ -961,7 +960,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@@ -972,10 +971,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@@ -995,11 +994,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@@ -1014,9 +1013,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@@ -1051,11 +1050,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@@ -1065,7 +1064,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@@ -1086,7 +1085,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@@ -1095,21 +1094,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@@ -1119,12 +1118,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@@ -1155,9 +1154,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@@ -1177,7 +1177,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@@ -1185,7 +1185,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@@ -1201,7 +1201,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@@ -1213,12 +1213,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@@ -1230,7 +1230,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@@ -1238,17 +1238,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@@ -1284,8 +1284,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\t\t\t\t\t. $remotename .\".namespaceCache\"));\n+\t\tmy @temp = split(/\\n/, 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@@ -1299,7 +1298,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@@ -1324,7 +1323,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@@ -1338,8 +1337,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.7.9.5\n"},{"id":"219733","messageId":"1370641344-4253-18-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 17/22] git-remote-mediawiki: Brace file handles for print for more clarity","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:18Z","receivedAt":"2013-06-07T21:42:18Z","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\nConflicts:\n\n\tcontrib/mw-to-git/git-remote-mediawiki.perl\n---\n contrib/mw-to-git/git-remote-mediawiki.perl |  184 +++++++++++++--------------\n 1 file changed, 92 insertions(+), 92 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\nindex 2d4ea1d..1024de1 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -172,8 +172,8 @@ sub parse_commands {\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 1;\n+\t\tprint {*STDERR} \"Unknown command. Aborting...\\n\";\n+\t\tlast;\n \t}\n \treturn 0;\n }\n@@ -199,7 +199,7 @@ 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@@ -267,9 +267,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@@ -294,14 +294,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@@ -313,7 +313,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@@ -331,14 +331,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@@ -371,9 +371,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@@ -460,7 +460,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@@ -487,13 +487,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@@ -526,7 +526,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@@ -547,7 +547,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@@ -600,7 +600,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@@ -619,26 +619,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@@ -674,11 +674,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@@ -724,42 +724,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\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@@ -790,7 +790,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@@ -807,30 +807,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@@ -909,7 +909,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@@ -942,7 +942,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@@ -956,11 +956,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@@ -974,8 +974,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@@ -987,9 +987,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@@ -1013,9 +1013,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@@ -1053,7 +1053,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@@ -1081,7 +1081,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@@ -1094,13 +1094,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@@ -1114,16 +1114,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@@ -1132,15 +1132,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@@ -1149,7 +1149,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@@ -1176,7 +1176,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@@ -1191,7 +1191,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@@ -1200,7 +1200,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@@ -1248,7 +1248,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@@ -1298,7 +1298,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@@ -1323,7 +1323,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.7.9.5\n"},{"id":"219729","messageId":"1370641344-4253-19-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 18/22] git-remote-mediawiki: Replace \"unless\" statements with negated \"if\" statements","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:19Z","receivedAt":"2013-06-07T21:42: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 |   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 1024de1..123730f 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -87,11 +87,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@@ -113,7 +113,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@@ -670,7 +670,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@@ -1242,7 +1242,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@@ -1322,7 +1322,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.7.9.5\n"},{"id":"219726","messageId":"1370641344-4253-20-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 19/22] git-remote-mediawiki: Don't use quotes for empty strings","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:20Z","receivedAt":"2013-06-07T21:42:20Z","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 123730f..e6dc6db 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -41,6 +41,8 @@ Readonly my $NULL_SHA1 => '0000000000000000000000000000000000000000';\n # Used on Git's side to reflect empty edit messages on the wiki\n Readonly my $EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n \n+Readonly my $EMPTY => q{};\n+\n if (@ARGV != 2) {\n \texit_error_usage();\n }\n@@ -163,11 +165,11 @@ sub parse_commands {\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@@ -558,7 +560,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@@ -569,7 +571,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@@ -995,7 +997,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@@ -1037,7 +1039,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@@ -1048,7 +1050,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@@ -1116,7 +1118,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.7.9.5\n"},{"id":"219728","messageId":"1370641344-4253-21-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 20/22] git-remote-mediawiki: Put non-trivial numeric values in constants.","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:21Z","receivedAt":"2013-06-07T21:42:21Z","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 e6dc6db..94a0411 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -43,6 +43,16 @@ Readonly my $EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n \n Readonly my $EMPTY => q{};\n \n+# Number of pages taken into account at once in submodule get_mw_page_list\n+Readonly my $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+Readonly my $BATCH_SIZE => 10;\n+\n+Readonly my $HTTP_CODE_OK => 200;\n+\n if (@ARGV != 2) {\n \texit_error_usage();\n }\n@@ -226,13 +236,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@@ -388,9 +398,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@@ -472,7 +480,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.7.9.5\n"},{"id":"219724","messageId":"1370641344-4253-22-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 21/22] git-remote-mediawiki: Fix a typo (\"mediwiki\" instead of \"mediawiki\")","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:22Z","receivedAt":"2013-06-07T21:42:22Z","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 94a0411..be860c8 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -1093,14 +1093,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.7.9.5\n"},{"id":"219725","messageId":"1370641344-4253-23-git-send-email-celestin.matte@ensimag.fr","threadId":"34053","inReplyTo":"1370641344-4253-1-git-send-email-celestin.matte@ensimag.fr","subject":"[PATCH v2 22/22] git-remote-mediawiki: Clearly rewrite double dereference","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-07T21:42:23Z","receivedAt":"2013-06-07T21:42:23Z","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 |   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 be860c8..a13c33f 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -234,7 +234,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@@ -736,7 +736,7 @@ sub import_file_revision {\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} \"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@@ -762,7 +762,7 @@ sub import_file_revision {\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} \"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@@ -884,7 +884,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@@ -919,7 +919,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@@ -952,7 +952,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.7.9.5\n"},{"id":"219765","messageId":"CAPig+cSMgdjew6oDPd64Wjm0MgF=iwR1g2NNRu6O1gTzvYHVkg@mail.gmail.com","threadId":"34053","inReplyTo":"1370641344-4253-23-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v2 22/22] git-remote-mediawiki: Clearly rewrite double dereference","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-07T23:34:22Z","receivedAt":"2013-06-07T23:34:22Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> @$var structures are re-written in the following way: @{$var}\n> It makes them more readable.\n>\n> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\n> Signed-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>\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n> index be860c8..a13c33f 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n> @@ -234,7 +234,7 @@ sub get_mw_tracked_pages {\n>  sub get_mw_page_list {\n>         my $page_list = shift;\n>         my $pages = shift;\n> -       my @some_pages = @$page_list;\n> +       my @some_pages = @{$page_list};\n>         while (@some_pages) {\n>                 my $last_page = $SLICE_SIZE;\n>                 if ($#some_pages < $last_page) {\n> @@ -736,7 +736,7 @@ sub import_file_revision {\n>\n>         print {*STDOUT} \"commit refs/mediawiki/${remotename}/master\\n\";\n>         print {*STDOUT} \"mark :${n}\\n\";\n> -       print {*STDOUT} \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n> +       print {*STDOUT} \"committer ${author} <${author}\\@{${wiki_name}}> \" . $date->epoch . \" +0000\\n\";\n\nIn this case, \\@ is a literal '@' in the string, so it is not a @$var\nreference, thus this change is incorrect.\n\n>         literal_data($comment);\n>\n>         # If it's not a clone, we need to know where to start from\n> @@ -762,7 +762,7 @@ sub import_file_revision {\n>                 print {*STDOUT} \"reset refs/notes/${remotename}/mediawiki\\n\";\n>         }\n>         print {*STDOUT} \"commit refs/notes/${remotename}/mediawiki\\n\";\n> -       print {*STDOUT} \"committer ${author} <${author}\\@${wiki_name}> \" . $date->epoch . \" +0000\\n\";\n> +       print {*STDOUT} \"committer ${author} <${author}\\@{${wiki_name}}> \" . $date->epoch . \" +0000\\n\";\n\nDitto: \\@ is a literal '@' in the string.\n\n>         literal_data('Note added by git-mediawiki during import');\n>         if (!$full_import && $n == 1) {\n>                 print {*STDOUT} \"from refs/notes/${remotename}/mediawiki^0\\n\";\n> @@ -884,7 +884,7 @@ sub mw_import_revids {\n>         my $n_actual = 0;\n>         my $last_timestamp = 0; # Placeholer in case $rev->timestamp is undefined\n>\n> -       foreach my $pagerevid (@$revision_ids) {\n> +       foreach my $pagerevid (@{$revision_ids}) {\n>                 # Count page even if we skip it, since we display\n>                 # $n/$total and $total includes skipped pages.\n>                 $n++;\n> @@ -919,7 +919,7 @@ sub mw_import_revids {\n>                 my $page_title = $result_page->{title};\n>\n>                 if (!exists($pages->{$page_title})) {\n> -                       print {*STDERR} \"${n}/\", scalar(@$revision_ids),\n> +                       print {*STDERR} \"${n}/\", scalar(@{$revision_ids}),\n>                                 \": Skipping revision #$rev->{revid} of ${page_title}\\n\";\n>                         next;\n>                 }\n> @@ -952,7 +952,7 @@ sub mw_import_revids {\n>                 # If this is a revision of the media page for new version\n>                 # of a file do one common commit for both file and media page.\n>                 # Else do commit only for that page.\n> -               print {*STDERR} \"${n}/\", scalar(@$revision_ids), \": Revision #$rev->{revid} of $commit{title}\\n\";\n> +               print {*STDERR} \"${n}/\", scalar(@{$revision_ids}), \": Revision #$rev->{revid} of $commit{title}\\n\";\n>                 import_file_revision(\\%commit, ($fetch_from == 1), $n_actual, \\%mediafile);\n>         }\n>\n> --\n"},{"id":"219768","messageId":"CAPig+cQ6MZpC2hGZUSf_9Xs7zFOgZG9EsNEDw1J-R48xvNQLNg@mail.gmail.com","threadId":"34053","inReplyTo":"1370641344-4253-8-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v2 07/22] git-remote-mediawiki: Change style of some regular expressions","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-08T00:12:15Z","receivedAt":"2013-06-08T00:12:15Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> - Remove m modifier when useless (m// and // was used randomly; this makes the\n> code more coherent)\n> - Remove stringy split (split('c', ...) instead of split(/c/, ...))\n> - Use {}{} instead of /// when slashes are used inside the regexp so as not to\n> escape it.\n\nWhen you split up 1/22 from v1 into distinct patches, review became\nmuch easier. The same can be done here (IMHO). The above bullet points\nare each conceptually distinct (even if they may happen to overlap\ntextually in some cases).\n\n> A \"split ' '\" is turned into a \"split / /\", which changes its behaviour: the old\n> method matched a run of whtespaces (/\\s*/), while the new one will match a\n> single whitespace, which is what we want here.\n\nThe phrase \"which is what we want here\" does not convey much. Taking a\nhint from Junio's responses explaining why he finds this subtle change\nacceptable, perhaps a paragraph like this might be appropriate:\n\n  Note the special case split(' ') for which Perl splits on runs of\n  whitespace, whereas split(/ /) splits on exactly one space.  In\n  other contexts, changing split(' ') to split(/ /) could potentially\n  be a regression, however, here, when parsing the output of\n  \"rev-list --parents\", whose output SHA-1's are each separated by a\n  single space, splitting on a single space is perfectly correct.\n\nMore comments below.\n\n> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\n> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n> ---\n>  contrib/mw-to-git/git-remote-mediawiki.perl |   20 ++++++++++----------\n>  1 file changed, 10 insertions(+), 10 deletions(-)\n>\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n> index a5c963b..482cd95 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n> @@ -121,7 +121,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> @@ -565,7 +565,7 @@ sub mediawiki_smudge {\n>\n>  sub mediawiki_clean_filename {\n>         my $filename = shift;\n> -       $filename =~ s/@{[SLASH_REPLACEMENT]}/\\//g;\n> +       $filename =~ s{$SLASH_REPLACEMENT}{/}g;\n\nThe change from SLASH_REPLACEMENT to $SLASH_REPLACEMENT should have\nhappened in patch 2/22 where 'constant' was replaced with 'Readonly'.\n\n>         # [, ], |, {, and } are forbidden by MediaWiki, even URL-encoded.\n>         # Do a variant of URL-encoding, i.e. looks like URL-encoding,\n>         # but with _ added to prevent MediaWiki from thinking this is\n> @@ -579,7 +579,7 @@ sub mediawiki_clean_filename {\n>\n>  sub mediawiki_smudge_filename {\n>         my $filename = shift;\n> -       $filename =~ s/\\//@{[SLASH_REPLACEMENT]}/g;\n> +       $filename =~ s{/}{$SLASH_REPLACEMENT}g;\n\nDitto regarding patch 2/22.\n\n>         $filename =~ s/ /_/g;\n>         # Decode forbidden characters encoded in mediawiki_clean_filename\n>         $filename =~ s/_%_([0-9a-fA-F][0-9a-fA-F])/sprintf(\"%c\", hex($1))/ge;\n> @@ -762,7 +762,7 @@ sub get_more_refs {\n>         my @refs;\n>         while (1) {\n>                 my $line = <STDIN>;\n> -               if ($line =~ m/^$cmd (.*)$/) {\n> +               if ($line =~ /^$cmd (.*)$/) {\n>                         push(@refs, $1);\n>                 } elsif ($line eq \"\\n\") {\n>                         return @refs;\n> @@ -1168,11 +1168,11 @@ sub mw_push_revision {\n>                 my @local_ancestry = split(/\\n/, run_git(\"rev-list --boundary --parents $local ^$parsed_sha1\"));\n>                 my %local_ancestry;\n>                 foreach my $line (@local_ancestry) {\n> -                       if (my ($child, $parents) = $line =~ m/^-?([a-f0-9]+) ([a-f0-9 ]+)/) {\n> -                               foreach my $parent (split(' ', $parents)) {\n> +                       if (my ($child, $parents) = $line =~ /^-?([a-f0-9]+) ([a-f0-9 ]+)/) {\n> +                               foreach my $parent (split(/ /, $parents)) {\n>                                         $local_ancestry{$parent} = $child;\n>                                 }\n> -                       } elsif (!$line =~ m/^([a-f0-9]+)/) {\n> +                       } elsif (!$line =~ /^([a-f0-9]+)/) {\n>                                 die \"Unexpected output from git rev-list: $line\";\n>                         }\n>                 }\n> @@ -1190,10 +1190,10 @@ sub mw_push_revision {\n>                 # history (linearized with --first-parent)\n>                 print STDERR \"Warning: no common ancestor, pushing complete history\\n\";\n>                 my $history = run_git(\"rev-list --first-parent --children $local\");\n> -               my @history = split('\\n', $history);\n> +               my @history = split(/\\n/, $history);\n\nThis looks fishy. In Perl, '\\n' is not a newline, but instead a\nliteral backslash followed by an \"n\". The output of \"rev-list\n--first-parent\" is line-oriented, so this looks like a bug in the\noriginal code, which you may want to fix it in a separate patch to\nmake it clear that this is an actual bug fix, distinct from the\notherwise mechanical change of split('x') to split(/x/).\n\n>                 @history = @history[1..$#history];\n>                 foreach my $line (reverse @history) {\n> -                       my @commit_info_split = split(/ |\\n/, $line);\n> +                       my @commit_info_split = split(/[ \\n]/, $line);\n>                         push(@commit_pairs, \\@commit_info_split);\n>                 }\n>         }\n> @@ -1272,7 +1272,7 @@ sub get_mw_namespace_id {\n>                 # Look at configuration file, if the record for that namespace is\n>                 # already cached. Namespaces are stored in form:\n>                 # \"Name_of_namespace:Id_namespace\", ex.: \"File:6\".\n> -               my @temp = split(/[\\n]/, run_git(\"config --get-all remote.\"\n> +               my @temp = split(/\\n/, run_git(\"config --get-all remote.\"\n>                                                 . $remotename .\".namespaceCache\"));\n>                 chomp(@temp);\n>                 foreach my $ns (@temp) {\n> --\n"},{"id":"219769","messageId":"CAPig+cQHPjjpt_JYHjua6VWzTjTFog9VzhpD0hOLKSPCrEnEdg@mail.gmail.com","threadId":"34053","inReplyTo":"1370641344-4253-15-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v2 14/22] git-remote-mediawiki: Check return value of open + remove import of unused open2","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-08T00:14:42Z","receivedAt":"2013-06-08T00:14:42Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\n> Signed-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>\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n> index ae6dd2e..1c34ada 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>  use Readonly;\n>\n>  # Mediawiki filenames can contain forward slashes. This variable decides by which pattern they should be replaced\n> @@ -338,7 +337,8 @@ sub get_mw_pages {\n>  sub run_git {\n>         my $args = shift;\n>         my $encoding = (shift || \"encoding(UTF-8)\");\n> -       open(my $git, \"-|:$encoding\", \"git \" . $args);\n> +       open(my $git, \"-|:$encoding\", \"git \" . $args)\n> +           or die \"Unable to open: $!\\n\";\n>         my $res = do {\n>                 local $/ = undef;\n>                 <$git>\n\nThese two changes are unrelated and could be split into distinct\npatches (IMHO, though others may disagree).\n"},{"id":"219771","messageId":"CAPig+cRckkYnDxqzvM4TZ_bOwpDBkn3aXNPy-sTg551d38L7jA@mail.gmail.com","threadId":"34053","inReplyTo":"1370641344-4253-16-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v2 15/22] git-remote-mediawiki: Put long code into a subroutine","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-08T00:27:38Z","receivedAt":"2013-06-08T00:27:38Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\n> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n> ---\n>  contrib/mw-to-git/git-remote-mediawiki.perl |   42 +++++++++++++++++----------\n>  1 file changed, 26 insertions(+), 16 deletions(-)\n>\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n> index 1c34ada..f37488b 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n> @@ -133,22 +133,7 @@ while (<STDIN>) {\n>         @cmd = split(/ /);\n>         if (defined($cmd[0])) {\n>                 # Line not blank\n> -               if ($cmd[0] eq \"capabilities\") {\n> -                       die(\"Too many arguments for capabilities\\n\") if (defined($cmd[1]));\n> -                       mw_capabilities();\n> -               } elsif ($cmd[0] eq \"list\") {\n> -                       die(\"Too many arguments for list\\n\") if (defined($cmd[2]));\n> -                       mw_list($cmd[1]);\n> -               } elsif ($cmd[0] eq \"import\") {\n> -                       die(\"Invalid arguments for import\\n\") if ($cmd[1] eq \"\" || defined($cmd[2]));\n> -                       mw_import($cmd[1]);\n> -               } elsif ($cmd[0] eq \"option\") {\n> -                       die(\"Too many arguments for option\\n\") if ($cmd[1] eq \"\" || $cmd[2] eq \"\" || defined($cmd[3]));\n> -                       mw_option($cmd[1],$cmd[2]);\n> -               } elsif ($cmd[0] eq \"push\") {\n> -                       mw_push($cmd[1]);\n> -               } else {\n> -                       print STDERR \"Unknown command. Aborting...\\n\";\n> +               if (parse_commands() == 1) {\n>                         last;\n\nBetter. A few minor nits:\n\nThe new subroutine is only parsing/invoking a single command at a time\nfrom the input line rather than multiple commands, so the name\nparse_commands() is slightly misleading. Perhaps parse_command() would\nbe more appropriate.\n\nNow that the functionality has been pushed into a subroutine, it does\nnot necessarily need to be accessing global @cmd. It might be\nappropriate to pass @cmd as an argument to parse_command() (or not\ndepending upon your preference).\n\nThe \"Unknown command. Aborting\" case indicates a failure. It's pretty\ntypical for failures to return false rather than true. The resulting\nconditional would then read a bit more idiomatically:\n\n  if (!parse_command(\\@cmd)) {\n    last;\n  }\n\n>                 }\n>         } else {\n> @@ -168,6 +153,31 @@ 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_commands {\n> +       if ($cmd[0] eq \"capabilities\") {\n> +               die(\"Too many arguments for capabilities\\n\")\n> +                   if (defined($cmd[1]));\n> +               mw_capabilities();\n> +       } elsif ($cmd[0] eq \"list\") {\n> +               die(\"Too many arguments for list\\n\") if (defined($cmd[2]));\n> +               mw_list($cmd[1]);\n> +       } elsif ($cmd[0] eq \"import\") {\n> +               die(\"Invalid arguments for import\\n\")\n> +                   if ($cmd[1] eq \"\" || defined($cmd[2]));\n> +               mw_import($cmd[1]);\n> +       } elsif ($cmd[0] eq \"option\") {\n> +               die(\"Too many arguments for option\\n\")\n> +                   if ($cmd[1] eq \"\" || $cmd[2] eq \"\" || defined($cmd[3]));\n> +               mw_option($cmd[1],$cmd[2]);\n> +       } elsif ($cmd[0] eq \"push\") {\n> +               mw_push($cmd[1]);\n> +       } else {\n> +               print STDERR \"Unknown command. Aborting...\\n\";\n> +               return 1;\n> +       }\n> +       return 0;\n> +}\n> +\n>  # MediaWiki API instance, created lazily.\n>  my $mediawiki;\n>\n> --\n"},{"id":"219773","messageId":"CAPig+cT6Qw1w4x95oT7PctMz_HnpU0Vwv5Bh=n-uqZQWJjFnBw@mail.gmail.com","threadId":"34053","inReplyTo":"1370641344-4253-17-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v2 16/22] git-remote-mediawiki: Modify strings for a better coding-style","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-08T00:39:43Z","receivedAt":"2013-06-08T00:39:43Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> - strings which don't need interpolation are single-quoted for more clarity and\n> slight 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\n> not have to be escaped\n\nDistinct changes could (IMHO) be split into separate patches for easier review.\n\n> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\n> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n>\n> Conflicts:\n>\n>         contrib/mw-to-git/git-remote-mediawiki.perl\n\nConflict information is not interesting to reviewers or even in final\ncommit messages since (hopefully) you will have resolved conflicts\nbefore committing. They can be stripped.\n\nMore below.\n\n> ---\n>  contrib/mw-to-git/git-remote-mediawiki.perl |  244 +++++++++++++--------------\n>  1 file changed, 121 insertions(+), 123 deletions(-)\n>\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n> index f37488b..2d4ea1d 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n> @@ -199,10 +199,10 @@ sub mw_connect_maybe {\n>                                lgdomain => $wiki_domain};\n>                 if ($mediawiki->login($request)) {\n>                         Git::credential \\%credential, 'approve';\n> -                       print STDERR \"Logged in mediawiki user \\\"$credential{username}\\\".\\n\";\n> +                       print STDERR qq(Logged in mediawiki user \"$credential{username}\".\\n);\n>                 } else {\n> -                       print STDERR \"Failed to log in mediawiki user \\\"$credential{username}\\\" on $url\\n\";\n> -                       print STDERR \"  (error \" .\n> +                       print {*STDERR} qq(Failed to log in mediawiki user \"$credential{username}\" on ${url}\\n);\n> +                       print {*STDERR} '  (error ' .\n\nThis change from patch 17/22 (adding braces around file handles)\nsneaked in early with this patch (16/22).\n\n>                                 $mediawiki->{error}->{code} . ': ' .\n>                                 $mediawiki->{error}->{details} . \")\\n\";\n>                         Git::credential \\%credential, 'reject';\n> @@ -473,27 +473,27 @@ sub download_mw_mediafile {\n>         if ($response->code == 200) {\n>                 return $response->decoded_content;\n>         } else {\n> -               print STDERR \"Error downloading mediafile from :\\n\";\n> -               print STDERR \"URL: $download_url\\n\";\n> -               print STDERR \"Server response: \" . $response->code . \" \" . $response->message . \"\\n\";\n> +               print {*STDERR} \"Error downloading mediafile from :\\n\";\n> +               print {*STDERR} \"URL: ${download_url}\\n\";\n> +               print {*STDERR} 'Server response: ' . $response->code . q{ } . $response->message . \"\\n\";\n\nDitto: Sneak in from 17/22.\n\n>                 exit 1;\n>         }\n>  }\n>\n>  sub get_last_local_revision {\n>         # Get note regarding last mediawiki revision\n> -       my $note = run_git(\"notes --ref=$remotename/mediawiki show refs/mediawiki/$remotename/master 2>/dev/null\");\n> +       my $note = run_git(\"notes --ref=${remotename}/mediawiki show refs/mediawiki/${remotename}/master 2>/dev/null\");\n>         my @note_info = split(/ /, $note);\n>\n>         my $lastrevision_number;\n> -       if (!(defined($note_info[0]) && $note_info[0] eq \"mediawiki_revision:\")) {\n> -               print STDERR \"No previous mediawiki revision found\";\n> +       if (!(defined($note_info[0]) && $note_info[0] eq 'mediawiki_revision:')) {\n> +               print STDERR 'No previous mediawiki revision found';\n>                 $lastrevision_number = 0;\n>         } else {\n>                 # Notes are formatted : mediawiki_revision: #number\n>                 $lastrevision_number = $note_info[1];\n>                 chomp($lastrevision_number);\n> -               print STDERR \"Last local mediawiki revision found is $lastrevision_number\";\n> +               print STDERR \"Last local mediawiki revision found is ${lastrevision_number}\";\n>         }\n>         return $lastrevision_number;\n>  }\n> @@ -690,8 +690,7 @@ sub fetch_mw_revisions {\n>         my $n = 1;\n>         foreach my $page (@pages) {\n>                 my $id = $page->{pageid};\n> -\n> -               print STDERR \"page $n/\", scalar(@pages), \": \". $page->{title} .\"\\n\";\n> +               print {*STDERR} \"page ${n}/\", scalar(@pages), ': ', $page->{title}, \"\\n\";\n\nAgain 17/22.\n\n>                 $n++;\n>                 my @page_revs = fetch_mw_revisions_for_page($page, $id, $fetch_from);\n>                 @revisions = (@page_revs, @revisions);\n> @@ -705,7 +704,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"},{"id":"219774","messageId":"CAPig+cQwBV5OfxH3-XrMd=J-fzTLmdSmoGOp-5o-Cj9mzJoVrw@mail.gmail.com","threadId":"34053","inReplyTo":"1370641344-4253-18-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v2 17/22] git-remote-mediawiki: Brace file handles for print for more clarity","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-08T00:42:35Z","receivedAt":"2013-06-08T00:42:35Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> This follows the following rule:\n> InputOutput::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>\n> Signed-off-by: Célestin Matte <celestin.matte@ensimag.fr>\n> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\n>\n> Conflicts:\n>\n>         contrib/mw-to-git/git-remote-mediawiki.perl\n\nUninteresting conflict information can be dropped.\n"},{"id":"219781","messageId":"20130608032324.GA20226@sigill.intra.peff.net","threadId":"34053","inReplyTo":"1370641344-4253-3-git-send-email-celestin.matte@ensimag.fr","subject":"Re: [PATCH v2 02/22] git-remote-mediawiki: Use the Readonly module instead of the constant pragma","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-06-08T03:23:25Z","receivedAt":"2013-06-08T03:23:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 07, 2013 at 11:42:03PM +0200, Célestin Matte wrote:\n\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n> index 4893442..e60793a 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n> @@ -26,21 +26,21 @@ use IPC::Open2;\n>  use Readonly;\n\nWhat does this series apply on top of? The existing version in \"master\"\ndoes not have \"use Readonly\" in it at all. The first version of your\nseries introduced that line, but here it is shown as an existing line.\nDid you miss a commit when putting your patches together?\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> +Readonly my $SLASH_REPLACEMENT => \"%2F\";\n\nWhat advantage does this have over \"use constant\"? I do not mind\nfollowing guidelines from perlcritic if they are a matter of style, but\nin this case there is a cost: we now depend on the \"Readonly\" module,\nwhich is not part of the standard distribution. I.e., users now have to\ndeal with installing an extra dependency. Is it worth it?\n\n-Peff\n"},{"id":"219789","messageId":"CAETqRCia1CqkaaHCFk=7mxVgmuN1VhBbGVs_oEaObUxwHZ33Zw@mail.gmail.com","threadId":"34053","inReplyTo":"20130608032324.GA20226@sigill.intra.peff.net","subject":"Re: [PATCH v2 02/22] git-remote-mediawiki: Use the Readonly module instead of the constant pragma","fromName":"Benoît Person","fromEmail":"benoit.person@ensimag.fr","sentAt":"2013-06-08T08:51:12Z","receivedAt":"2013-06-08T08:51:12Z","isPatch":true,"sender":{"key":"benoit.person@ensimag.fr","avatar":null},"body":"The major drawback of using perl `constant` is the fact that they do\nnot interpolate like variables in most of the contexts (those who\nautomatically quotes barewords). Like said on Perl Monks here [1], you\nhave to do some \"tricks\" depending on the context in which you're\nusing the constant and that's not really \"clean\".\n\nBut maybe trading clean for another package is not worth it. I just\nsearched for alternatives way of doing it and none seems to be in the\ncore packages so maybe we should just drop this.\n\n[1] http://www.perlmonks.org/?node_id=777711\n\nOn 8 June 2013 05:23, Jeff King <peff@peff.net> wrote:\n> On Fri, Jun 07, 2013 at 11:42:03PM +0200, Célestin Matte wrote:\n>\n>> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n>> index 4893442..e60793a 100755\n>> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n>> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n>> @@ -26,21 +26,21 @@ use IPC::Open2;\n>>  use Readonly;\n>\n> What does this series apply on top of? The existing version in \"master\"\n> does not have \"use Readonly\" in it at all. The first version of your\n> series introduced that line, but here it is shown as an existing line.\n> Did you miss a commit when putting your patches together?\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>> +Readonly my $SLASH_REPLACEMENT => \"%2F\";\n>\n> What advantage does this have over \"use constant\"? I do not mind\n> following guidelines from perlcritic if they are a matter of style, but\n> in this case there is a cost: we now depend on the \"Readonly\" module,\n> which is not part of the standard distribution. I.e., users now have to\n> deal with installing an extra dependency. Is it worth it?\n>\n> -Peff\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"219813","messageId":"51B32B0F.1030400@gmail.com","threadId":"34053","inReplyTo":"20130608032324.GA20226@sigill.intra.peff.net","subject":"Re: [PATCH v2 02/22] git-remote-mediawiki: Use the Readonly module instead of the constant pragma","fromName":"Célestin Perdu","fromEmail":"tohwiq@gmail.com","sentAt":"2013-06-08T13:01:03Z","receivedAt":"2013-06-08T13:01:03Z","isPatch":true,"sender":{"key":"tohwiq@gmail.com","avatar":null},"body":"Le 08/06/2013 05:23, Jeff King a écrit :\n> What does this series apply on top of? The existing version in \"master\"\n> does not have \"use Readonly\" in it at all. The first version of your\n> series introduced that line, but here it is shown as an existing line.\n> Did you miss a commit when putting your patches together?\n\nOh yes, part of this commit went into the previous one, which was not\nformated as an email when I did my git-format-patch. I should check my\npatches more carefully before sending them. Sorry for this.\n\n> What advantage does this have over \"use constant\"? I do not mind\n> following guidelines from perlcritic if they are a matter of style, but\n> in this case there is a cost: we now depend on the \"Readonly\" module,\n> which is not part of the standard distribution. I.e., users now have to\n> deal with installing an extra dependency. Is it worth it?\n\nLike Benoit said, the problem is that they sometimes don't interpolate.\nI don't know if we should keep this commit or not.\n"},{"id":"219835","messageId":"51B353A7.1090206@ensimag.fr","threadId":"34053","inReplyTo":"CAPig+cQHPjjpt_JYHjua6VWzTjTFog9VzhpD0hOLKSPCrEnEdg@mail.gmail.com","subject":"Re: [PATCH v2 14/22] git-remote-mediawiki: Check return value of open + remove import of unused open2","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-08T15:54:15Z","receivedAt":"2013-06-08T15:54:15Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 08/06/2013 02:14, Eric Sunshine a écrit :\n> These two changes are unrelated and could be split into distinct\n> patches (IMHO, though others may disagree).\n\nTwo distinct patches or two distinct commits?\nI assumed it was two distinct commits, but thinking about it, removing a\nlibrary could have its own patch.\n\n-- \nCélestin Matte\n"},{"id":"219845","messageId":"20130608173149.GC28029@sigill.intra.peff.net","threadId":"34053","inReplyTo":"51B32B0F.1030400@gmail.com","subject":"Re: [PATCH v2 02/22] git-remote-mediawiki: Use the Readonly module instead of the constant pragma","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-06-08T17:31:49Z","receivedAt":"2013-06-08T17:31:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jun 08, 2013 at 03:01:03PM +0200, Célestin Perdu wrote:\n\n> Oh yes, part of this commit went into the previous one, which was not\n> formated as an email when I did my git-format-patch. I should check my\n> patches more carefully before sending them. Sorry for this.\n\nNo problem. It is easy to make simple mistakes like that with our\nworkflow, but it is also easy to fix them and repost. :)\n\n> > What advantage does this have over \"use constant\"? I do not mind\n> > following guidelines from perlcritic if they are a matter of style, but\n> > in this case there is a cost: we now depend on the \"Readonly\" module,\n> > which is not part of the standard distribution. I.e., users now have to\n> > deal with installing an extra dependency. Is it worth it?\n> \n> Like Benoit said, the problem is that they sometimes don't interpolate.\n> I don't know if we should keep this commit or not.\n\nThanks both for the explanation.  I don't see us using that to our\nadvantage anywhere in the patch. So I think this is purely a style\nissue, which to me indicates that the extra dependency is not worth it,\nand the patch should be dropped.\n\n-Peff\n"},{"id":"219851","messageId":"vpqtxl8v4oq.fsf@anie.imag.fr","threadId":"34053","inReplyTo":"20130608173149.GC28029@sigill.intra.peff.net","subject":"Re: [PATCH v2 02/22] git-remote-mediawiki: Use the Readonly module instead of the constant pragma","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-06-08T18:27:17Z","receivedAt":"2013-06-08T18:27:17Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Jeff King <peff@peff.net> writes:\n\n> Thanks both for the explanation.  I don't see us using that to our\n> advantage anywhere in the patch. So I think this is purely a style\n> issue, which to me indicates that the extra dependency is not worth it,\n> and the patch should be dropped.\n\nSame here: I'd rather keep the dependency list small.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"219854","messageId":"vpqd2rwv40f.fsf@anie.imag.fr","threadId":"34053","inReplyTo":"51B353A7.1090206@ensimag.fr","subject":"Re: [PATCH v2 14/22] git-remote-mediawiki: Check return value of open + remove import of unused open2","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-06-08T18:41:52Z","receivedAt":"2013-06-08T18:41:52Z","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> Le 08/06/2013 02:14, Eric Sunshine a écrit :\n>> These two changes are unrelated and could be split into distinct\n>> patches (IMHO, though others may disagree).\n>\n> Two distinct patches or two distinct commits?\n\nThat's the same. You write commits locally, send them as patches, and\nJunio uses \"git am\" to turn the patches back into commits.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"219855","messageId":"51B37BB0.7000504@ensimag.fr","threadId":"34053","inReplyTo":"vpqd2rwv40f.fsf@anie.imag.fr","subject":"Re: [PATCH v2 14/22] git-remote-mediawiki: Check return value of open + remove import of unused open2","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-08T18:45:04Z","receivedAt":"2013-06-08T18:45:04Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 08/06/2013 20:41, Matthieu Moy a écrit :\n> Célestin Matte <celestin.matte@ensimag.fr> writes:\n> \n>> Le 08/06/2013 02:14, Eric Sunshine a écrit :\n>>> These two changes are unrelated and could be split into distinct\n>>> patches (IMHO, though others may disagree).\n>>\n>> Two distinct patches or two distinct commits?\n> \n> That's the same. You write commits locally, send them as patches, and\n> Junio uses \"git am\" to turn the patches back into commits.\n> \n\nOh, I thought a part of a patch was called a commit. So the question was\nrather: \"Should it be sent to this list independently from this series\nof patches?\".\n\n-- \nCélestin Matte\n"},{"id":"219857","messageId":"vpqtxl8tody.fsf@anie.imag.fr","threadId":"34053","inReplyTo":"51B37BB0.7000504@ensimag.fr","subject":"Re: [PATCH v2 14/22] git-remote-mediawiki: Check return value of open + remove import of unused open2","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-06-08T19:04:41Z","receivedAt":"2013-06-08T19:04:41Z","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> Oh, I thought a part of a patch was called a commit.\n\n1 patch = 1 commit\n1 patch series = several commits sent together. Will normally end-up in\n                 a branch in Junio's repo (named with <initials>/<topic>)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"219860","messageId":"51B394E5.8040104@ensimag.fr","threadId":"34053","inReplyTo":"CAPig+cT6Qw1w4x95oT7PctMz_HnpU0Vwv5Bh=n-uqZQWJjFnBw@mail.gmail.com","subject":"Re: [PATCH v2 16/22] git-remote-mediawiki: Modify strings for a better coding-style","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-08T20:32:37Z","receivedAt":"2013-06-08T20:32:37Z","isPatch":true,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 08/06/2013 02:39, Eric Sunshine a écrit :\n> On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n> <celestin.matte@ensimag.fr> wrote:\n>> - strings which don't need interpolation are single-quoted for more clarity and\n>> slight 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\n>> not have to be escaped\n> \n> Distinct changes could (IMHO) be split into separate patches for easier review.\n\nThis commit is a real pain to cut into 3 distinctive ones. Is this\nreally necessary?\nI will do it if it is, of course.\n\n\n-- \nCélestin Matte\n"},{"id":"219879","messageId":"CAPig+cT5YQb9ZTX=x0bSv6Y=stWpR77wKt0xt-CuFhMidc3Ocw@mail.gmail.com","threadId":"34053","inReplyTo":"51B394E5.8040104@ensimag.fr","subject":"Re: [PATCH v2 16/22] git-remote-mediawiki: Modify strings for a better coding-style","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-09T04:44:53Z","receivedAt":"2013-06-09T04:44:53Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Jun 8, 2013 at 4:32 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> Le 08/06/2013 02:39, Eric Sunshine a écrit :\n>> On Fri, Jun 7, 2013 at 5:42 PM, Célestin Matte\n>> <celestin.matte@ensimag.fr> wrote:\n>>> - strings which don't need interpolation are single-quoted for more clarity and\n>>> slight 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\n>>> not have to be escaped\n>>\n>> Distinct changes could (IMHO) be split into separate patches for easier review.\n>\n> This commit is a real pain to cut into 3 distinctive ones. Is this\n> really necessary?\n> I will do it if it is, of course.\n\n[I think you meant that it would be split into 4 patches.]\n\nThe final decision is up to the submitter (you) and the people signing\noff on and accepting the patch (Matthieu and Junio).\n\nSpeaking merely as a person reviewing the patch series, I can say that\nmixing conceptually unrelated changes into a single patch makes review\nmore onerous since it requires repeatedly switching mental gears\n(often from line to line or even within a single line). Patches\ninvolving simple \"mechanical\" changes typically are easy to review,\neven when the patches are lengthy. In this case, however, that length\ncoupled with the mental gear switching, makes the review process more\nburdensome that it need be.\n\nEven if you decide ultimately not to bother splitting the patch,\nease-of-review and one-conceptual-change-per-patch are useful notions\nto keep in mind for future submissions.\n"},{"id":"219880","messageId":"CAPig+cQbTGGn8-cHySj4_rQ9dbtoLEhC+9RbJhDeHLpQ0L1xLw@mail.gmail.com","threadId":"34053","inReplyTo":"51B37BB0.7000504@ensimag.fr","subject":"Re: [PATCH v2 14/22] git-remote-mediawiki: Check return value of open + remove import of unused open2","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2013-06-09T04:52:44Z","receivedAt":"2013-06-09T04:52:44Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Jun 8, 2013 at 2:45 PM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n> Le 08/06/2013 20:41, Matthieu Moy a écrit :\n>> Célestin Matte <celestin.matte@ensimag.fr> writes:\n>>\n>>> Le 08/06/2013 02:14, Eric Sunshine a écrit :\n>>>> These two changes are unrelated and could be split into distinct\n>>>> patches (IMHO, though others may disagree).\n>>>\n>>> Two distinct patches or two distinct commits?\n>>\n>> That's the same. You write commits locally, send them as patches, and\n>> Junio uses \"git am\" to turn the patches back into commits.\n>>\n>\n> Oh, I thought a part of a patch was called a commit. So the question was\n> rather: \"Should it be sent to this list independently from this series\n> of patches?\".\n\nTerms \"patch\" and \"commit\" tend to be used interchangeably, as Matthieu notes.\n\nThere is no need to send the split up patches to the list\nindependently from this series.\n"}]}