{"thread":{"id":"34738","subject":"[PATCH 2/2] git-remote-mediawiki: add test and check Makefile targets","startedAt":"2013-08-21T08:10:16Z","lastAt":"2013-08-21T20:26:17Z","messageCount":4,"participants":["Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"225603","messageId":"1377072617-25086-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"34738","inReplyTo":null,"subject":"[PATCH 1/2] git-remote-mediawiki: reset private ref after non-dumb push","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-08-21T08:10:16Z","receivedAt":"2013-08-21T08:10:16Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Git-mediawiki's \"dumb push\" sends the local revisions to the remote wiki,\nbut does not update the local metadata to reflect the push (hence, the\nnext pull will have to re-import the exported revisions).\n\nThe previous implementation was simply omitting the update to the private\nref after a dumb push. This was broken by 664059fb62 (Felipe Contreras,\nApr 17 2013, transport-helper: update remote helper namespace), which\ndoes an automatic update of the private ref (not just the\nremote-tracking) on push.\n\nThis patch fixes git-remote-mediawiki to reset the private ref after the\npush is completed, cancelling the automatic update triggered by\n664059fb62.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nJust a resend of the RFC\n( http://thread.gmane.org/gmane.comp.version-control.git/232224 ),\nwhich received no comment.\n\n contrib/mw-to-git/git-remote-mediawiki.perl | 9 +++++++--\n 1 file changed, 7 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 f8d7d2c..13919ad 100755\n--- a/contrib/mw-to-git/git-remote-mediawiki.perl\n+++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n@@ -53,6 +53,7 @@ if (@ARGV != 2) {\n \n my $remotename = $ARGV[0];\n my $url = $ARGV[1];\n+my $reset_private_ref_to = undef;\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@@ -161,6 +162,9 @@ sub parse_command {\n \tmy ($line) = @_;\n \tmy @cmd = split(/ /, $line);\n \tif (!defined $cmd[0]) {\n+\t\tif ($reset_private_ref_to) {\n+\t\t\trun_git(\"update-ref -m \\\"Git-MediaWiki non-dumb push\\\" refs/mediawiki/$remotename/master $reset_private_ref_to\");\n+\t\t}\n \t\treturn 0;\n \t}\n \tif ($cmd[0] eq 'capabilities') {\n@@ -1209,9 +1213,10 @@ 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\tif (!$dumb_push) {\n+\t\tif ($dumb_push) {\n+\t\t\t$reset_private_ref_to = $remoteorigin_sha1;\n+\t\t} else {\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-- \n1.8.4.rc2.18.g030d947\n"},{"id":"225602","messageId":"1377072617-25086-2-git-send-email-Matthieu.Moy@imag.fr","threadId":"34738","inReplyTo":"1377072617-25086-1-git-send-email-Matthieu.Moy@imag.fr","subject":"[PATCH 2/2] git-remote-mediawiki: add test and check Makefile targets","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2013-08-21T08:10:17Z","receivedAt":"2013-08-21T08:10:17Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"There are a few level 4 and 2 perlcritic issues in the current code.\nWe make level 5 fatal, and keep level 2 as warnings so that \"make\ncheck\" pass.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n contrib/mw-to-git/Makefile | 10 +++++++++-\n 1 file changed, 9 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/mw-to-git/Makefile b/contrib/mw-to-git/Makefile\nindex 76fcd4d..f206f96 100644\n--- a/contrib/mw-to-git/Makefile\n+++ b/contrib/mw-to-git/Makefile\n@@ -24,6 +24,11 @@ INSTLIBDIR=$(shell $(MAKE) -C $(GIT_ROOT_DIR)/perl \\\n \n all: build\n \n+test: all\n+\t$(MAKE) -C t\n+\n+check: perlcritic test\n+\n install_pm:\n \tinstall $(GIT_MEDIAWIKI_PM) $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM)\n \n@@ -41,4 +46,7 @@ clean:\n \trm $(INSTLIBDIR)/$(GIT_MEDIAWIKI_PM)\n \n perlcritic:\n-\tperlcritic -2 *.perl\n+\tperlcritic -5 $(SCRIPT_PERL)\n+\t-perlcritic -2 $(SCRIPT_PERL)\n+\n+.PHONY: all test check install_pm install clean perlcritic\n-- \n1.8.4.rc2.18.g030d947\n"},{"id":"225622","messageId":"xmqq1u5nudq8.fsf@gitster.dls.corp.google.com","threadId":"34738","inReplyTo":"1377072617-25086-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH 1/2] git-remote-mediawiki: reset private ref after non-dumb push","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-21T17:59:27Z","receivedAt":"2013-08-21T17:59:27Z","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> Git-mediawiki's \"dumb push\" sends the local revisions to the remote wiki,\n> but does not update the local metadata to reflect the push (hence, the\n> next pull will have to re-import the exported revisions).\n>\n> The previous implementation was simply omitting the update to the private\n> ref after a dumb push. This was broken by 664059fb62 (Felipe Contreras,\n> Apr 17 2013, transport-helper: update remote helper namespace), which\n> does an automatic update of the private ref (not just the\n> remote-tracking) on push.\n>\n> This patch fixes git-remote-mediawiki to reset the private ref after the\n> push is completed, cancelling the automatic update triggered by\n> 664059fb62.\n>\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n> Just a resend of the RFC\n> ( http://thread.gmane.org/gmane.comp.version-control.git/232224 ),\n> which received no comment.\n>\n>  contrib/mw-to-git/git-remote-mediawiki.perl | 9 +++++++--\n>  1 file changed, 7 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 f8d7d2c..13919ad 100755\n> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n> @@ -53,6 +53,7 @@ if (@ARGV != 2) {\n>  \n>  my $remotename = $ARGV[0];\n>  my $url = $ARGV[1];\n> +my $reset_private_ref_to = undef;\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> @@ -161,6 +162,9 @@ sub parse_command {\n>  \tmy ($line) = @_;\n>  \tmy @cmd = split(/ /, $line);\n>  \tif (!defined $cmd[0]) {\n> +\t\tif ($reset_private_ref_to) {\n> +\t\t\trun_git(\"update-ref -m \\\"Git-MediaWiki non-dumb push\\\" refs/mediawiki/$remotename/master $reset_private_ref_to\");\n> +\t\t}\n\nSo reset-private-ref-to is recorded for a non-dumb push, but...\n\n>  \t\treturn 0;\n>  \t}\n>  \tif ($cmd[0] eq 'capabilities') {\n> @@ -1209,9 +1213,10 @@ 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\tif (!$dumb_push) {\n> +\t\tif ($dumb_push) {\n> +\t\t\t$reset_private_ref_to = $remoteorigin_sha1;\n\n... it is set for dumb-push?  I am confused.\n\n> +\t\t} else {\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"},{"id":"225637","messageId":"vpqy57u7pue.fsf@anie.imag.fr","threadId":"34738","inReplyTo":"xmqq1u5nudq8.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 1/2] git-remote-mediawiki: reset private ref after non-dumb push","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-08-21T20:26:17Z","receivedAt":"2013-08-21T20:26:17Z","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>> diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl\n>> index f8d7d2c..13919ad 100755\n>> --- a/contrib/mw-to-git/git-remote-mediawiki.perl\n>> +++ b/contrib/mw-to-git/git-remote-mediawiki.perl\n>> @@ -53,6 +53,7 @@ if (@ARGV != 2) {\n>>  \n>>  my $remotename = $ARGV[0];\n>>  my $url = $ARGV[1];\n>> +my $reset_private_ref_to = undef;\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>> @@ -161,6 +162,9 @@ sub parse_command {\n>>  \tmy ($line) = @_;\n>>  \tmy @cmd = split(/ /, $line);\n>>  \tif (!defined $cmd[0]) {\n>> +\t\tif ($reset_private_ref_to) {\n>> +\t\t\trun_git(\"update-ref -m \\\"Git-MediaWiki non-dumb push\\\" refs/mediawiki/$remotename/master $reset_private_ref_to\");\n>> +\t\t}\n>\n> So reset-private-ref-to is recorded for a non-dumb push, but...\n\n> ... it is set for dumb-push?  I am confused.\n\nOops, I'm the one who did the confusion indeed. It should be\ns/non-dumb/dumb/ here and in the subject line.\n\nDon't merge this one, I've fixed locally and will resend (this or\nanother fix, depending on the outcome of the discussion).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}