{"thread":{"id":"31033","subject":"[PATCH 2/8] git-remote-mediawiki: actually send empty comment when they're empty","startedAt":"2012-07-16T12:00:45Z","lastAt":"2012-07-23T07:42:59Z","messageCount":33,"participants":["Matthieu Moy","Junio C Hamano","Dan Johnson"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"195112","messageId":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":null,"subject":"[PATCH 0/8] git-remote-mediawiki: fixes, optimizations, and progress report","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:45Z","receivedAt":"2012-07-16T12:00:45Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"After the recent improvements to git-remote-mediawiki, I did a bit of\nreal-life testing, by importing https://ensiwiki.ensimag.fr/ and\nhttps://git.wiki.kernel.org/. It turned out we had a few blocking bugs\nand a grossly unoptimized algorithm on push. This patch serie makes\ngit-remote-mediawiki usable on these wikis (although it's still a bit\nslow).\n\nMy initial patch serie also contained a patch \"git-remote-mediawiki:\nreplace TODO-list in comment by appropriate link\" that replaced the\nTODO-list in the comments of the file with just \n\n # Gateway between Git and MediaWiki.\n # Documentation & bugtracker: https://github.com/moy/Git-Mediawiki/\n\nbut I'm holding it for now as there seems to be interest in changing\nthe homepage, so the link may not be appropriate.\n\nMatthieu Moy (8):\n  git-remote-mediawiki: don't split namespaces with spaces\n  git-remote-mediawiki: actually send empty comment when they're empty\n  git-remote-mediawiki: make mediafiles export optional\n  git-remote-mediawiki: get rid of O(N^2) loop\n  git-remote-mediawiki: use --force when adding notes\n  git-remote-mediawiki: show progress information when listing pages\n  git-remote-mediawiki: show progress information when getting last\n    remote revision\n  git-remote-mediawiki: properly deal with invalid remote revisions\n\n contrib/mw-to-git/git-remote-mediawiki | 80 +++++++++++++++++++++++++++-------\n 1 file changed, 64 insertions(+), 16 deletions(-)\n\n-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195110","messageId":"1342440053-3058-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 1/8] git-remote-mediawiki: don't split namespaces with spaces","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:46Z","receivedAt":"2012-07-16T12:00:46Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex accd70a..a6ad8cf 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -1275,7 +1275,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.11.1.30.g7e1baf9.dirty\n"},{"id":"195105","messageId":"1342440053-3058-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 2/8] git-remote-mediawiki: actually send empty comment when they're empty","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:47Z","receivedAt":"2012-07-16T12:00:47Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex a6ad8cf..a2da52f 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -51,6 +51,9 @@ use constant EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n # used to reflect file creation or deletion in diff.\n use constant NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n \n+# Used on Git's side to reflect empty edit messages on the wiki\n+use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n+\n my $remotename = $ARGV[0];\n my $url = $ARGV[1];\n \n@@ -935,7 +938,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 MediaWiki 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@@ -1050,6 +1053,10 @@ sub mw_push_file {\n \tmy $oldrevid = shift;\n \tmy $newrevid;\n \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-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195108","messageId":"1342440053-3058-4-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 3/8] git-remote-mediawiki: make mediafiles export optional","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:48Z","receivedAt":"2012-07-16T12:00:48Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 24 ++++++++++++++++++++++--\n 1 file changed, 22 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex a2da52f..8e46e4e 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -66,11 +66,16 @@ chomp(@tracked_pages);\n my @tracked_categories = split(/[ \\n]/, run_git(\"config --get-all remote.\". $remotename .\".categories\"));\n chomp(@tracked_categories);\n \n-# Import media files too.\n+# Import media files on pull\n my $import_media = run_git(\"config --get --bool remote.\". $remotename .\".mediaimport\");\n chomp($import_media);\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+chomp($export_media);\n+$export_media = !($export_media eq \"false\");\n+\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@@ -1068,6 +1073,11 @@ sub mw_push_file {\n \t\t$extension = \"\";\n \t}\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\t}\n \t\tmy $file_content;\n \t\tif ($page_deleted) {\n \t\t\t# Deleting a page usually requires\n@@ -1107,10 +1117,12 @@ sub mw_push_file {\n \t\t}\n \t\t$newrevid = $result->{edit}->{newrevid};\n \t\tprint STDERR \"Pushed file: $new_sha1 - $title\\n\";\n-\t} else {\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}\n \t$newrevid = ($newrevid or $oldrevid);\n \treturn ($newrevid, \"ok\");\n@@ -1328,3 +1340,11 @@ sub get_mw_namespace_id {\n \t\tdie \"No such namespace $name on MediaWiki.\";\n \t}\n }\n+\n+sub get_mw_namespace_id_for_page {\n+\tif (my ($namespace) = $_[0] =~ /^([^:]*):/) {\n+\t\treturn get_mw_namespace_id($namespace);\n+\t} else {\n+\t\treturn;\n+\t}\n+}\n-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195109","messageId":"1342440053-3058-5-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 4/8] git-remote-mediawiki: get rid of O(N^2) loop","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:49Z","receivedAt":"2012-07-16T12:00:49Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"The algorithm to find a path from the local revision to the remote one\nwas calling \"git rev-list\" and parsing its output N times. Run rev-list\nonly once, and fill a hashtable with the result to optimize the body of\nthe loop.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 25 ++++++++++++++++++-------\n 1 file changed, 18 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex 8e46e4e..f9c0cc6 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -1196,16 +1196,27 @@ 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\tmy @local_ancestry = split(/\\n/, run_git(\"rev-list --boundary --children $local ^$parsed_sha1\"));\n+\t\tmy %local_ancestry;\n+\t\tforeach my $line (@local_ancestry) {\n+\t\t\tif (my ($parent, $child) = $line =~ m/^-?([a-f0-9]+) ([a-f0-9]+)/) {\n+\t\t\t\t$local_ancestry{$parent} = $child;\n+\t\t\t\tif ($parent eq $parsed_sha1 || $child eq $parsed_sha1) {\n+\t\t\t\t\tprint STDERR \"$parent -> $child\\n\";\n+\t\t\t\t}\n+\t\t\t} elsif (!$line =~ m/^([a-f0-9]+)/) {\n+\t\t\t\tdie \"Unexpected output from git rev-list: $line\";\n+\t\t\t}\n+\t\t}\n \t\twhile ($parsed_sha1 ne $HEAD_sha1) {\n-\t\t\tmy @commit_info =  grep(/^$parsed_sha1/, split(/\\n/, run_git(\"rev-list --children $local\")));\n-\t\t\tif (!@commit_info) {\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\treturn error_non_fast_forward($remote);\n \t\t\t}\n-\t\t\tmy @commit_info_split = split(/ |\\n/, $commit_info[0]);\n-\t\t\t# $commit_info_split[1] is the sha1 of the commit to export\n-\t\t\t# $commit_info_split[0] is the sha1 of its direct child\n-\t\t\tpush(@commit_pairs, \\@commit_info_split);\n-\t\t\t$parsed_sha1 = $commit_info_split[1];\n+\t\t\tpush(@commit_pairs, [$parsed_sha1, $child]);\n+\t\t\t$parsed_sha1 = $child;\n \t\t}\n \t} else {\n \t\t# No remote mediawiki revision. Export the whole\n-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195106","messageId":"1342440053-3058-6-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 5/8] git-remote-mediawiki: use --force when adding notes","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:50Z","receivedAt":"2012-07-16T12:00:50Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"When notes are created to record a push, it normally doesn't exist yet.\nHowever, when a push is interrupted and then restarted, it may happen\nthat a commit already has notes attached, and we want to reflect the newly\ncreated remote revision, hence use 'git notes add -f' to override the\nexisting one\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex f9c0cc6..f56f9b0 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -1264,7 +1264,7 @@ sub mw_push_revision {\n \t\t\t}\n \t\t}\n \t\tunless ($dumb_push) {\n-\t\t\trun_git(\"notes --ref=$remotename/mediawiki add -m \\\"mediawiki_revision: $mw_revision\\\" $sha1_commit\");\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}\n \t}\n-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195107","messageId":"1342440053-3058-7-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 6/8] git-remote-mediawiki: show progress information when listing pages","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:51Z","receivedAt":"2012-07-16T12:00:51Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Initial phases of push and pull with git-remote-mediawiki can be long on\na large wiki. Let the user know what's going on.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex f56f9b0..755c9d0 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -371,6 +371,8 @@ 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+\n \tmy %pages; # hash on page titles to avoid duplicates\n \tmy $user_defined;\n \tif (@tracked_pages) {\n@@ -394,6 +396,7 @@ sub get_mw_pages {\n \t\t\tget_all_mediafiles(\\%pages);\n \t\t}\n \t}\n+\tprint STDERR (scalar keys %pages) . \" pages found.\\n\";\n \treturn %pages;\n }\n \n-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195113","messageId":"1342440053-3058-8-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 7/8] git-remote-mediawiki: show progress information when getting last remote revision","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:52Z","receivedAt":"2012-07-16T12:00:52Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex 755c9d0..cf467ac 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -579,6 +579,8 @@ 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+\n \tforeach my $page (@pages) {\n \t\tmy $id = $page->{pageid};\n \n-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195111","messageId":"1342440053-3058-9-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 8/8] git-remote-mediawiki: properly deal with invalid remote revisions","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T12:00:53Z","receivedAt":"2012-07-16T12:00:53Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Some wiki, including https://git.wiki.kernel.org/ have invalid revision\nnumbers (i.e. the actual revision numbers are non-contiguous). Don't die\nwhen encountering one.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 13 +++++++++----\n 1 file changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex cf467ac..80a07cc 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -910,6 +910,10 @@ sub mw_import_revids {\n \tmy $last_timestamp = 0; # Placeholer in case $rev->timestamp is undefined\n \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+\n \t\t# fetch the content of the pages\n \t\tmy $query = {\n \t\t\taction => 'query',\n@@ -924,6 +928,11 @@ sub mw_import_revids {\n \t\t\tdie \"Failed to retrieve modified page for revision $pagerevid\";\n \t\t}\n \n+\t\tif (defined($result->{query}->{badrevids}->{$pagerevid})) {\n+\t\t\t# The revision id does not exist on the remote wiki.\n+\t\t\tnext;\n+\t\t}\n+\n \t\tif (!defined($result->{query}->{pages})) {\n \t\t\tdie \"Invalid revision $pagerevid.\";\n \t\t}\n@@ -932,10 +941,6 @@ sub mw_import_revids {\n \t\tmy $result_page = $result_pages[0];\n \t\tmy $rev = $result_pages[0]->{revisions}->[0];\n \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-\n \t\tmy $page_title = $result_page->{title};\n \n \t\tif (!exists($pages->{$page_title})) {\n-- \n1.7.11.1.30.g7e1baf9.dirty\n"},{"id":"195138","messageId":"7vd33v377x.fsf@alter.siamese.dyndns.org","threadId":"31033","inReplyTo":"1342440053-3058-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 2/8] git-remote-mediawiki: actually send empty comment when they're empty","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T18:13:06Z","receivedAt":"2012-07-16T18:13:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n>  contrib/mw-to-git/git-remote-mediawiki | 9 ++++++++-\n>  1 file changed, 8 insertions(+), 1 deletion(-)\n>\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\n> index a6ad8cf..a2da52f 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki\n> +++ b/contrib/mw-to-git/git-remote-mediawiki\n> @@ -51,6 +51,9 @@ use constant EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n>  # used to reflect file creation or deletion in diff.\n>  use constant NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n>  \n> +# Used on Git's side to reflect empty edit messages on the wiki\n> +use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n> +\n\nIs there a reason why this sentinel value cannot be a real empty\nstring?\n\nNot that I am complaining, as I find it highly unlikely for a\nmessage stored in mw to be exactly \"*Empty MediaWiki Message*\", but\njust wondering.\n\n>  my $remotename = $ARGV[0];\n>  my $url = $ARGV[1];\n>  \n> @@ -935,7 +938,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 MediaWiki 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> @@ -1050,6 +1053,10 @@ sub mw_push_file {\n>  \tmy $oldrevid = shift;\n>  \tmy $newrevid;\n>  \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"},{"id":"195139","messageId":"7v7gu3373x.fsf@alter.siamese.dyndns.org","threadId":"31033","inReplyTo":"1342440053-3058-4-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 3/8] git-remote-mediawiki: make mediafiles export optional","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T18:15:30Z","receivedAt":"2012-07-16T18:15:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n\nIt would have been nicer to hint why people may want to omit\nmediafiles from their export under what condition somewhere in the\ndocumentation or at least in the proposed commit log message.\n"},{"id":"195140","messageId":"7v394r36ws.fsf@alter.siamese.dyndns.org","threadId":"31033","inReplyTo":"1342440053-3058-5-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 4/8] git-remote-mediawiki: get rid of O(N^2) loop","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T18:19:47Z","receivedAt":"2012-07-16T18:19:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> The algorithm to find a path from the local revision to the remote one\n> was calling \"git rev-list\" and parsing its output N times. Run rev-list\n> only once, and fill a hashtable with the result to optimize the body of\n> the loop.\n\nGood thinking.  I wonder if it would further reduce the overhead if\nyou stop using --children and do this using --parents instead, as\nyou will be reading the parsed_sha1..local range either way yourself\nanyway.\n\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n>  contrib/mw-to-git/git-remote-mediawiki | 25 ++++++++++++++++++-------\n>  1 file changed, 18 insertions(+), 7 deletions(-)\n>\n> diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\n> index 8e46e4e..f9c0cc6 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki\n> +++ b/contrib/mw-to-git/git-remote-mediawiki\n> @@ -1196,16 +1196,27 @@ 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\tmy @local_ancestry = split(/\\n/, run_git(\"rev-list --boundary --children $local ^$parsed_sha1\"));\n> +\t\tmy %local_ancestry;\n> +\t\tforeach my $line (@local_ancestry) {\n> +\t\t\tif (my ($parent, $child) = $line =~ m/^-?([a-f0-9]+) ([a-f0-9]+)/) {\n> +\t\t\t\t$local_ancestry{$parent} = $child;\n> +\t\t\t\tif ($parent eq $parsed_sha1 || $child eq $parsed_sha1) {\n> +\t\t\t\t\tprint STDERR \"$parent -> $child\\n\";\n> +\t\t\t\t}\n> +\t\t\t} elsif (!$line =~ m/^([a-f0-9]+)/) {\n> +\t\t\t\tdie \"Unexpected output from git rev-list: $line\";\n> +\t\t\t}\n> +\t\t}\n>  \t\twhile ($parsed_sha1 ne $HEAD_sha1) {\n> -\t\t\tmy @commit_info =  grep(/^$parsed_sha1/, split(/\\n/, run_git(\"rev-list --children $local\")));\n> -\t\t\tif (!@commit_info) {\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\treturn error_non_fast_forward($remote);\n>  \t\t\t}\n> -\t\t\tmy @commit_info_split = split(/ |\\n/, $commit_info[0]);\n> -\t\t\t# $commit_info_split[1] is the sha1 of the commit to export\n> -\t\t\t# $commit_info_split[0] is the sha1 of its direct child\n> -\t\t\tpush(@commit_pairs, \\@commit_info_split);\n> -\t\t\t$parsed_sha1 = $commit_info_split[1];\n> +\t\t\tpush(@commit_pairs, [$parsed_sha1, $child]);\n> +\t\t\t$parsed_sha1 = $child;\n>  \t\t}\n>  \t} else {\n>  \t\t# No remote mediawiki revision. Export the whole\n"},{"id":"195141","messageId":"7vvchn1s39.fsf@alter.siamese.dyndns.org","threadId":"31033","inReplyTo":"1342440053-3058-2-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 1/8] git-remote-mediawiki: don't split namespaces with spaces","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T18:25:14Z","receivedAt":"2012-07-16T18:25:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Looks sensible.\n"},{"id":"195143","messageId":"7vr4sb1quf.fsf@alter.siamese.dyndns.org","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 0/8] git-remote-mediawiki: fixes, optimizations, and progress report","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T18:52:08Z","receivedAt":"2012-07-16T18:52:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks for updates. Will queue on 'pu' as-is.\n"},{"id":"195148","messageId":"vpqr4sbv83q.fsf@bauges.imag.fr","threadId":"31033","inReplyTo":"7vd33v377x.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/8] git-remote-mediawiki: actually send empty comment when they're empty","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-07-16T19:06:33Z","receivedAt":"2012-07-16T19:06:33Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>\n>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n>> ---\n>>  contrib/mw-to-git/git-remote-mediawiki | 9 ++++++++-\n>>  1 file changed, 8 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\n>> index a6ad8cf..a2da52f 100755\n>> --- a/contrib/mw-to-git/git-remote-mediawiki\n>> +++ b/contrib/mw-to-git/git-remote-mediawiki\n>> @@ -51,6 +51,9 @@ use constant EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n>>  # used to reflect file creation or deletion in diff.\n>>  use constant NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n>>  \n>> +# Used on Git's side to reflect empty edit messages on the wiki\n>> +use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n>> +\n>\n> Is there a reason why this sentinel value cannot be a real empty\n> string?\n\nThat would mean having an empty commit message on the Git side, which is\nagainst the use (although possible with fast-import). The import turns\nempty mediawiki messages (which are very common in my experience) into\nthis string to provide a nicer-looking history.\n\nIt's not like EMPTY_CONTENT, which is explicitely forbidden on the\nMediaWiki side, hence really cannot be the empty string.\n\nIdeally, EMPTY_MESSAGE could be configurable, and the empty string could\nbe an acceptable value to make this conversion optional.\n\n(note that the string was already there, my patch only makes it a\nconstant to be able to use it in two distinct places).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"195150","messageId":"7va9yz1pnm.fsf@alter.siamese.dyndns.org","threadId":"31033","inReplyTo":"vpqr4sbv83q.fsf@bauges.imag.fr","subject":"Re: [PATCH 2/8] git-remote-mediawiki: actually send empty comment when they're empty","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T19:17:49Z","receivedAt":"2012-07-16T19:17:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>>\n>>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n>>> ---\n>>>  contrib/mw-to-git/git-remote-mediawiki | 9 ++++++++-\n>>>  1 file changed, 8 insertions(+), 1 deletion(-)\n>>>\n>>> diff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\n>>> index a6ad8cf..a2da52f 100755\n>>> --- a/contrib/mw-to-git/git-remote-mediawiki\n>>> +++ b/contrib/mw-to-git/git-remote-mediawiki\n>>> @@ -51,6 +51,9 @@ use constant EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n>>>  # used to reflect file creation or deletion in diff.\n>>>  use constant NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n>>>  \n>>> +# Used on Git's side to reflect empty edit messages on the wiki\n>>> +use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n>>> +\n>>\n>> Is there a reason why this sentinel value cannot be a real empty\n>> string?\n>\n> That would mean having an empty commit message on the Git side, which is\n> against the use (although possible with fast-import).\n\nIt also is possible with \"commit --allow-empty-message\", no?\n\n> (note that the string was already there, my patch only makes it a\n> constant to be able to use it in two distinct places).\n\nIt was clear from the patch text without looking beyond context, but\nafter all I thought this was meant to be a clean-up series, and I\nsimply wondered why mapping empty to some magic string was not\nconsidered to be something to be cleaned up.  That's all.\n\nI obviously do not care that deeply either way.\n"},{"id":"195152","messageId":"vpqhat7v6xe.fsf@bauges.imag.fr","threadId":"31033","inReplyTo":"7v394r36ws.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 4/8] git-remote-mediawiki: get rid of O(N^2) loop","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-07-16T19:31:57Z","receivedAt":"2012-07-16T19:31:57Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>\n>> The algorithm to find a path from the local revision to the remote one\n>> was calling \"git rev-list\" and parsing its output N times. Run rev-list\n>> only once, and fill a hashtable with the result to optimize the body of\n>> the loop.\n>\n> Good thinking.  I wonder if it would further reduce the overhead if\n> you stop using --children and do this using --parents instead, as\n> you will be reading the parsed_sha1..local range either way yourself\n> anyway.\n\nIt is possible, yes. I'll resend a version with --parents, but this\nprobably doesn't change the performance much: what we really need is for\nGit to prune dead-ends in the subgraph, to make sure we find a path\nwithout having to backtrack (i.e. we need parent rewriting history\nsimplification), so Git has to do something a bit clever anyway.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"195153","messageId":"vpqbojfv6j0.fsf@bauges.imag.fr","threadId":"31033","inReplyTo":"7v7gu3373x.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/8] git-remote-mediawiki: make mediafiles export optional","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-07-16T19:40:35Z","receivedAt":"2012-07-16T19:40:35Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>\n>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n>\n> It would have been nicer to hint why people may want to omit\n> mediafiles from their export under what condition somewhere in the\n> documentation or at least in the proposed commit log message.\n\nThe real use-case for which I implemented is a bit particular (described\nbelow), but I'll resend with a more general explanation.\n\nFor the curious: I have a wiki with ~2Gb of mediafiles, and I want to\nsecure it without particular access to the server. I import the wiki on\na desktop machine with a large disk, and re-export it to another\nwebserver with a small disk quota. Importing mediafiles is good because\nit gives me a backup, but exporting them is not an option as my quota on\nthe webserver is too small.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"195154","messageId":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342440053-3058-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 0/8 v2] git-remote-mediawiki: fixes, optimizations, and progress report","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:34Z","receivedAt":"2012-07-16T19:46:34Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Changes since v1: more explanations in commit message for \"make\nmediafiles export optional\", and use --parents instead of --children\nin \"get rid of O(N^2) loop\".\n\nMatthieu Moy (8):\n  git-remote-mediawiki: don't split namespaces with spaces\n  git-remote-mediawiki: actually send empty comment when they're empty\n  git-remote-mediawiki: make mediafiles export optional\n  git-remote-mediawiki: get rid of O(N^2) loop\n  git-remote-mediawiki: use --force when adding notes\n  git-remote-mediawiki: show progress information when listing pages\n  git-remote-mediawiki: show progress information when getting last\n    remote revision\n  git-remote-mediawiki: properly deal with invalid remote revisions\n\n contrib/mw-to-git/git-remote-mediawiki | 79 +++++++++++++++++++++++++++-------\n 1 file changed, 63 insertions(+), 16 deletions(-)\n\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195155","messageId":"1342468002-31818-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 1/8] git-remote-mediawiki: don't split namespaces with spaces","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:35Z","receivedAt":"2012-07-16T19:46:35Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex accd70a..a6ad8cf 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -1275,7 +1275,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.11.2.258.g5ff3cdf.dirty\n"},{"id":"195160","messageId":"1342468002-31818-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 2/8] git-remote-mediawiki: actually send empty comment when they're empty","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:36Z","receivedAt":"2012-07-16T19:46:36Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex a6ad8cf..a2da52f 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -51,6 +51,9 @@ use constant EMPTY_CONTENT => \"<!-- empty page -->\\n\";\n # used to reflect file creation or deletion in diff.\n use constant NULL_SHA1 => \"0000000000000000000000000000000000000000\";\n \n+# Used on Git's side to reflect empty edit messages on the wiki\n+use constant EMPTY_MESSAGE => '*Empty MediaWiki Message*';\n+\n my $remotename = $ARGV[0];\n my $url = $ARGV[1];\n \n@@ -935,7 +938,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 MediaWiki 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@@ -1050,6 +1053,10 @@ sub mw_push_file {\n \tmy $oldrevid = shift;\n \tmy $newrevid;\n \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-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195162","messageId":"1342468002-31818-4-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 3/8] git-remote-mediawiki: make mediafiles export optional","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:37Z","receivedAt":"2012-07-16T19:46:37Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"It is possible to use git-remote-mediawiki on a tree with both .mw files\nand other files. Before git-remote-mediawiki learnt how to export\nmediafiles, such mixed trees allowed the user to maintain both the wiki\nand other files for the same project in the same repository. With the\nnewly added support for exporting mediafiles, pushing such mixed trees\nwould upload unrelated files as mediafiles, which may not be desired.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 24 ++++++++++++++++++++++--\n 1 file changed, 22 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex a2da52f..8e46e4e 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -66,11 +66,16 @@ chomp(@tracked_pages);\n my @tracked_categories = split(/[ \\n]/, run_git(\"config --get-all remote.\". $remotename .\".categories\"));\n chomp(@tracked_categories);\n \n-# Import media files too.\n+# Import media files on pull\n my $import_media = run_git(\"config --get --bool remote.\". $remotename .\".mediaimport\");\n chomp($import_media);\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+chomp($export_media);\n+$export_media = !($export_media eq \"false\");\n+\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@@ -1068,6 +1073,11 @@ sub mw_push_file {\n \t\t$extension = \"\";\n \t}\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\t}\n \t\tmy $file_content;\n \t\tif ($page_deleted) {\n \t\t\t# Deleting a page usually requires\n@@ -1107,10 +1117,12 @@ sub mw_push_file {\n \t\t}\n \t\t$newrevid = $result->{edit}->{newrevid};\n \t\tprint STDERR \"Pushed file: $new_sha1 - $title\\n\";\n-\t} else {\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}\n \t$newrevid = ($newrevid or $oldrevid);\n \treturn ($newrevid, \"ok\");\n@@ -1328,3 +1340,11 @@ sub get_mw_namespace_id {\n \t\tdie \"No such namespace $name on MediaWiki.\";\n \t}\n }\n+\n+sub get_mw_namespace_id_for_page {\n+\tif (my ($namespace) = $_[0] =~ /^([^:]*):/) {\n+\t\treturn get_mw_namespace_id($namespace);\n+\t} else {\n+\t\treturn;\n+\t}\n+}\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195159","messageId":"1342468002-31818-5-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 4/8] git-remote-mediawiki: get rid of O(N^2) loop","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:38Z","receivedAt":"2012-07-16T19:46:38Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"The algorithm to find a path from the local revision to the remote one\nwas calling \"git rev-list\" and parsing its output N times. Run rev-list\nonly once, and fill a hashtable with the result to optimize the body of\nthe loop.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 24 +++++++++++++++++-------\n 1 file changed, 17 insertions(+), 7 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex 8e46e4e..fb1e9e0 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -1196,16 +1196,26 @@ 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\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\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\tdie \"Unexpected output from git rev-list: $line\";\n+\t\t\t}\n+\t\t}\n \t\twhile ($parsed_sha1 ne $HEAD_sha1) {\n-\t\t\tmy @commit_info =  grep(/^$parsed_sha1/, split(/\\n/, run_git(\"rev-list --children $local\")));\n-\t\t\tif (!@commit_info) {\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\treturn error_non_fast_forward($remote);\n \t\t\t}\n-\t\t\tmy @commit_info_split = split(/ |\\n/, $commit_info[0]);\n-\t\t\t# $commit_info_split[1] is the sha1 of the commit to export\n-\t\t\t# $commit_info_split[0] is the sha1 of its direct child\n-\t\t\tpush(@commit_pairs, \\@commit_info_split);\n-\t\t\t$parsed_sha1 = $commit_info_split[1];\n+\t\t\tpush(@commit_pairs, [$parsed_sha1, $child]);\n+\t\t\t$parsed_sha1 = $child;\n \t\t}\n \t} else {\n \t\t# No remote mediawiki revision. Export the whole\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195157","messageId":"1342468002-31818-6-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 5/8] git-remote-mediawiki: use --force when adding notes","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:39Z","receivedAt":"2012-07-16T19:46:39Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"When notes are created to record a push, it normally doesn't exist yet.\nHowever, when a push is interrupted and then restarted, it may happen\nthat a commit already has notes attached, and we want to reflect the newly\ncreated remote revision, hence use 'git notes add -f' to override the\nexisting one\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex fb1e9e0..517a4db 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -1263,7 +1263,7 @@ sub mw_push_revision {\n \t\t\t}\n \t\t}\n \t\tunless ($dumb_push) {\n-\t\t\trun_git(\"notes --ref=$remotename/mediawiki add -m \\\"mediawiki_revision: $mw_revision\\\" $sha1_commit\");\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}\n \t}\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195156","messageId":"1342468002-31818-7-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 6/8] git-remote-mediawiki: show progress information when listing pages","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:40Z","receivedAt":"2012-07-16T19:46:40Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Initial phases of push and pull with git-remote-mediawiki can be long on\na large wiki. Let the user know what's going on.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex 517a4db..729a0bc 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -371,6 +371,8 @@ 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+\n \tmy %pages; # hash on page titles to avoid duplicates\n \tmy $user_defined;\n \tif (@tracked_pages) {\n@@ -394,6 +396,7 @@ sub get_mw_pages {\n \t\t\tget_all_mediafiles(\\%pages);\n \t\t}\n \t}\n+\tprint STDERR (scalar keys %pages) . \" pages found.\\n\";\n \treturn %pages;\n }\n \n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195161","messageId":"1342468002-31818-8-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 7/8] git-remote-mediawiki: show progress information when getting last remote revision","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:41Z","receivedAt":"2012-07-16T19:46:41Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex 729a0bc..8badff6 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -579,6 +579,8 @@ 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+\n \tforeach my $page (@pages) {\n \t\tmy $id = $page->{pageid};\n \n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195158","messageId":"1342468002-31818-9-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 8/8] git-remote-mediawiki: properly deal with invalid remote revisions","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-16T19:46:42Z","receivedAt":"2012-07-16T19:46:42Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Some wiki, including https://git.wiki.kernel.org/ have invalid revision\nnumbers (i.e. the actual revision numbers are non-contiguous). Don't die\nwhen encountering one.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki | 13 +++++++++----\n 1 file changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex 8badff6..5eab96b 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -910,6 +910,10 @@ sub mw_import_revids {\n \tmy $last_timestamp = 0; # Placeholer in case $rev->timestamp is undefined\n \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+\n \t\t# fetch the content of the pages\n \t\tmy $query = {\n \t\t\taction => 'query',\n@@ -924,6 +928,11 @@ sub mw_import_revids {\n \t\t\tdie \"Failed to retrieve modified page for revision $pagerevid\";\n \t\t}\n \n+\t\tif (defined($result->{query}->{badrevids}->{$pagerevid})) {\n+\t\t\t# The revision id does not exist on the remote wiki.\n+\t\t\tnext;\n+\t\t}\n+\n \t\tif (!defined($result->{query}->{pages})) {\n \t\t\tdie \"Invalid revision $pagerevid.\";\n \t\t}\n@@ -932,10 +941,6 @@ sub mw_import_revids {\n \t\tmy $result_page = $result_pages[0];\n \t\tmy $rev = $result_pages[0]->{revisions}->[0];\n \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-\n \t\tmy $page_title = $result_page->{title};\n \n \t\tif (!exists($pages->{$page_title})) {\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195163","messageId":"7v1ukb1nvv.fsf@alter.siamese.dyndns.org","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 0/8 v2] git-remote-mediawiki: fixes, optimizations, and progress report","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-16T19:56:04Z","receivedAt":"2012-07-16T19:56:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks; will replace and requeue.\n"},{"id":"195203","messageId":"1342533960-22123-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342468002-31818-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 0/2] git-remote-mediawiki: two more fixes","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-17T14:05:58Z","receivedAt":"2012-07-17T14:05:58Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"These patches can be added to branch mm/mediawiki-usability in pu.\n\nFor the curious: I originally had patch 2/2 in my serie, but\nmistakenly discarded it during a rebase. While recovering it and\ntesting it, I found a typo fixed by patch 1/2.\n\nMatthieu Moy (2):\n  git-remote-mediawiki: fix incorrect test usage in test\n  git-remote-mediawiki: allow page names with a ':'\n\n contrib/mw-to-git/git-remote-mediawiki      | 49 +++++++++++++++++++----------\n contrib/mw-to-git/t/push-pull-tests.sh      |  2 +-\n contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh | 20 ++++++++++++\n 3 files changed, 54 insertions(+), 17 deletions(-)\n\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195205","messageId":"1342533960-22123-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342533960-22123-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 1/2] git-remote-mediawiki: fix incorrect test usage in test","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-17T14:05:59Z","receivedAt":"2012-07-17T14:05:59Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/t/push-pull-tests.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/t/push-pull-tests.sh b/contrib/mw-to-git/t/push-pull-tests.sh\nindex 6692a0f..9da2dc5 100644\n--- a/contrib/mw-to-git/t/push-pull-tests.sh\n+++ b/contrib/mw-to-git/t/push-pull-tests.sh\n@@ -104,7 +104,7 @@ test_push_pull () {\n \t\t\tgit push\n \t\t) &&\n \n-\t\ttest ! wiki_page_exist Foo\n+\t\ttest_must_fail wiki_page_exist Foo\n \t'\n \n \ttest_expect_success 'Merge conflict expected and solving it' '\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195204","messageId":"1342533960-22123-3-git-send-email-Matthieu.Moy@imag.fr","threadId":"31033","inReplyTo":"1342533960-22123-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 2/2] git-remote-mediawiki: allow page names with a ':'","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-07-17T14:06:00Z","receivedAt":"2012-07-17T14:06:00Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Traditionnally, pages named Foo:Bar are page 'Bar' in namespace 'Foo'.\nHowever, it is also possible to call a page Foo:Bar if 'Foo' is not a\nnamespace. In this case, the actual name of the page is 'Foo:Bar', in the\nmain namespace. Since we can't tell with only the filename, query the\nwiki for a namespace 'Foo' in these cases, but deal with the case where\nno such namespace is found.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/git-remote-mediawiki      | 49 +++++++++++++++++++----------\n contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh | 20 ++++++++++++\n 2 files changed, 53 insertions(+), 16 deletions(-)\n\ndiff --git a/contrib/mw-to-git/git-remote-mediawiki b/contrib/mw-to-git/git-remote-mediawiki\nindex d6be188..47d4878 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki\n+++ b/contrib/mw-to-git/git-remote-mediawiki\n@@ -955,8 +955,11 @@ sub mw_import_revids {\n \t\t# Differentiates classic pages and media files.\n \t\tmy ($namespace, $filename) = $page_title =~ /^([^:]*):(.*)$/;\n \t\tmy %mediafile;\n-\t\tif ($namespace && get_mw_namespace_id($namespace) == get_mw_namespace_id(\"File\")) {\n-\t\t\t%mediafile = get_mw_mediafile_for_page_revision($filename, $rev->{timestamp});\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\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@@ -1306,7 +1309,11 @@ sub get_mw_namespace_id {\n \t\tchomp(@temp);\n \t\tforeach my $ns (@temp) {\n \t\t\tmy ($n, $id) = split(/:/, $ns);\n-\t\t\t$namespace_id{$n} = $id;\n+\t\t\tif ($id eq 'notANameSpace') {\n+\t\t\t\t$namespace_id{$n} = {is_namespace => 0};\n+\t\t\t} else {\n+\t\t\t\t$namespace_id{$n} = {is_namespace => 1, id => $id};\n+\t\t\t}\n \t\t\t$cached_mw_namespace_id{$n} = 1;\n \t\t}\n \t}\n@@ -1324,28 +1331,38 @@ sub get_mw_namespace_id {\n \n \t        while (my ($id, $ns) = each(%{$result->{query}->{namespaces}})) {\n \t                if (defined($ns->{id}) && defined($ns->{canonical})) {\n-\t\t\t\t$namespace_id{$ns->{canonical}} = $ns->{id};\n+\t\t\t\t$namespace_id{$ns->{canonical}} = {is_namespace => 1, id => $ns->{id}};\n \t\t\t\tif ($ns->{'*'}) {\n \t\t\t\t\t# alias (e.g. french Fichier: as alias for canonical File:)\n-\t\t\t\t\t$namespace_id{$ns->{'*'}} = $ns->{id};\n+\t\t\t\t\t$namespace_id{$ns->{'*'}} = {is_namespace => 1, id => $ns->{id}};\n \t\t\t\t}\n \t\t\t}\n \t        }\n \t}\n \n-\tmy $id = $namespace_id{$name};\n+\tmy $ns = $namespace_id{$name};\n+\tmy $id;\n \n-\tif (defined $id) {\n-\t\t# Store explicitely requested namespaces on disk\n-\t\tif (!exists $cached_mw_namespace_id{$name}) {\n-\t\t\trun_git(\"config --add remote.\". $remotename\n-\t\t\t\t.\".namespaceCache \\\"\". $name .\":\". $id .\"\\\"\");\n-\t\t\t$cached_mw_namespace_id{$name} = 1;\n-\t\t}\n-\t\treturn $id;\n-\t} else {\n-\t\tdie \"No such namespace $name on MediaWiki.\";\n+\tunless (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+\t}\n+\n+\tif ($ns->{is_namespace}) {\n+\t\t$id = $ns->{id};\n+\t}\n+\n+\t# Store \"notANameSpace\" as special value for inexisting namespaces\n+\tmy $store_id = ($id || 'notANameSpace');\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\t$cached_mw_namespace_id{$name} = 1;\n \t}\n+\treturn $id;\n }\n \n sub get_mw_namespace_id_for_page {\ndiff --git a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh\nindex 8635878..246d47d 100755\n--- a/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh\n+++ b/contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh\n@@ -169,6 +169,26 @@ test_expect_failure 'special character at the begining of file name from mw to g\n \ttest_path_is_file mw_dir_11/[char_2\n '\n \n+test_expect_success 'Pull page with title containing \":\" other than namespace separator' '\n+\twiki_editpage Foo:Bar content false &&\n+\t(\n+\t\tcd mw_dir_11 &&\n+\t\tgit pull\n+\t) &&\n+\ttest_path_is_file mw_dir_11/Foo:Bar.mw\n+'\n+\n+test_expect_success 'Push page with title containing \":\" other than namespace separator' '\n+\t(\n+\t\tcd mw_dir_11 &&\n+\t\techo content >NotANameSpace:Page.mw &&\n+\t\tgit add NotANameSpace:Page.mw &&\n+\t\tgit commit -m \"add page with colon\" &&\n+\t\tgit push\n+\t) &&\n+\twiki_page_exist NotANameSpace:Page\n+'\n+\n test_expect_success 'test of correct formating for file name from mw to git' '\n \twiki_reset &&\n \tgit clone mediawiki::'\"$WIKI_URL\"' mw_dir_12 &&\n-- \n1.7.11.2.258.g5ff3cdf.dirty\n"},{"id":"195385","messageId":"CAPBPrnvoqh4-6vnhhd67tdBZRSqY-ixkzPxTfJDcchmQYxZghQ@mail.gmail.com","threadId":"31033","inReplyTo":"1342533960-22123-3-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 2/2] git-remote-mediawiki: allow page names with a ':'","fromName":"Dan Johnson","fromEmail":"computerdruid@gmail.com","sentAt":"2012-07-20T21:11:44Z","receivedAt":"2012-07-20T21:11:44Z","isPatch":true,"sender":{"key":"computerdruid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/34696?v=4"},"body":"On Tue, Jul 17, 2012 at 10:06 AM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:\n> Traditionnally, pages named Foo:Bar are page 'Bar' in namespace 'Foo'.\n> However, it is also possible to call a page Foo:Bar if 'Foo' is not a\n> namespace. In this case, the actual name of the page is 'Foo:Bar', in the\n> main namespace. Since we can't tell with only the filename, query the\n> wiki for a namespace 'Foo' in these cases, but deal with the case where\n> no such namespace is found.\n\nMight not be worth fixing, and it's just a typo in the commit message, but:\ns/Traditionnally/Traditionally/\n?\n\n-- \n-Dan\n"},{"id":"195515","messageId":"vpqy5mancsc.fsf@bauges.imag.fr","threadId":"31033","inReplyTo":"CAPBPrnvoqh4-6vnhhd67tdBZRSqY-ixkzPxTfJDcchmQYxZghQ@mail.gmail.com","subject":"Re: [PATCH 2/2] git-remote-mediawiki: allow page names with a ':'","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-07-23T07:42:59Z","receivedAt":"2012-07-23T07:42:59Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Dan Johnson <computerdruid@gmail.com> writes:\n\n> On Tue, Jul 17, 2012 at 10:06 AM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:\n>> Traditionnally, pages named Foo:Bar are page 'Bar' in namespace 'Foo'.\n>> However, it is also possible to call a page Foo:Bar if 'Foo' is not a\n>> namespace. In this case, the actual name of the page is 'Foo:Bar', in the\n>> main namespace. Since we can't tell with only the filename, query the\n>> wiki for a namespace 'Foo' in these cases, but deal with the case where\n>> no such namespace is found.\n>\n> Might not be worth fixing, and it's just a typo in the commit message, but:\n> s/Traditionnally/Traditionally/\n> ?\n\nThanks, but the topic is in next already, so it's too late to fix the\ncommit message.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}