{"thread":{"id":"25217","subject":"[PATCH] git-svn: allow the mergeinfo property to be set","startedAt":"2010-09-24T00:52:33Z","lastAt":"2010-10-04T22:05:58Z","messageCount":7,"participants":["Steven Walter","Eric Wong","Mathias Lafeldt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"151418","messageId":"1285289553-17998-1-git-send-email-stevenrwalter@gmail.com","threadId":"25217","inReplyTo":null,"subject":"[PATCH] git-svn: allow the mergeinfo property to be set","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2010-09-24T00:52:33Z","receivedAt":"2010-09-24T00:52:33Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"As a first step towards preserving merges across dcommit, we need a\nmechanism to update the svn:mergeinfo property.\n---\n git-svn.perl |   15 ++++++++++++++-\n 1 files changed, 14 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex c7c4dcd..1612fd7 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -83,7 +83,7 @@ my ($_stdin, $_help, $_edit,\n \t$_version, $_fetch_all, $_no_rebase, $_fetch_parent,\n \t$_merge, $_strategy, $_dry_run, $_local,\n \t$_prefix, $_no_checkout, $_url, $_verbose,\n-\t$_git_format, $_commit_url, $_tag);\n+\t$_git_format, $_commit_url, $_tag, $_merge_info);\n $Git::SVN::_follow_parent = 1;\n $_q ||= 0;\n my %remote_opts = ( 'username=s' => \\$Git::SVN::Prompt::_username,\n@@ -153,6 +153,7 @@ my %cmd = (\n \t\t\t  'commit-url=s' => \\$_commit_url,\n \t\t\t  'revision|r=i' => \\$_revision,\n \t\t\t  'no-rebase' => \\$_no_rebase,\n+\t\t\t  'mergeinfo=s' => \\$_merge_info,\n \t\t\t%cmt_opts, %fc_opts } ],\n \tbranch => [ \\&cmd_branch,\n \t            'Create a branch in the SVN repository',\n@@ -568,6 +569,7 @@ sub cmd_dcommit {\n \t\t\t                       print \"Committed r$_[0]\\n\";\n \t\t\t                       $cmt_rev = $_[0];\n \t\t\t                },\n+\t\t\t\t\tmergeinfo => $_merge_info,\n \t\t\t                svn_path => '');\n \t\t\tif (!SVN::Git::Editor->new(\\%ed_opts)->apply_diff) {\n \t\t\t\tprint \"No changes\\n$d~1 == $d\\n\";\n@@ -4449,6 +4451,7 @@ sub new {\n \t$self->{path_prefix} = length $self->{svn_path} ?\n \t                       \"$self->{svn_path}/\" : '';\n \t$self->{config} = $opts->{config};\n+\t$self->{mergeinfo} = $opts->{mergeinfo};\n \treturn $self;\n }\n \n@@ -4758,6 +4761,11 @@ sub change_file_prop {\n \t$self->SUPER::change_file_prop($fbat, $pname, $pval, $self->{pool});\n }\n \n+sub change_dir_prop {\n+\tmy ($self, $pbat, $pname, $pval) = @_;\n+\t$self->SUPER::change_dir_prop($pbat, $pname, $pval, $self->{pool});\n+}\n+\n sub _chg_file_get_blob ($$$$) {\n \tmy ($self, $fbat, $m, $which) = @_;\n \tmy $fh = $::_repository->temp_acquire(\"git_blob_$which\");\n@@ -4851,6 +4859,11 @@ sub apply_diff {\n \t\t\tfatal(\"Invalid change type: $f\");\n \t\t}\n \t}\n+\n+\tif (defined($self->{mergeinfo})) {\n+\t\t$self->change_dir_prop($self->{bat}{''}, \"svn:mergeinfo\",\n+\t\t\t               $self->{mergeinfo});\n+\t}\n \t$self->rmdirs if $_rmdir;\n \tif (@$mods == 0) {\n \t\t$self->abort_edit;\n-- \n1.7.3.4.g4d78d\n"},{"id":"151509","messageId":"20100924162704.GA4513@dcvr.yhbt.net","threadId":"25217","inReplyTo":"1285289553-17998-1-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH] git-svn: allow the mergeinfo property to be set","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-09-24T16:27:04Z","receivedAt":"2010-09-24T16:27:04Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Steven Walter <stevenrwalter@gmail.com> wrote:\n> As a first step towards preserving merges across dcommit, we need a\n> mechanism to update the svn:mergeinfo property.\n> ---\n\nHi Steven, this looks reasonable.  Sign-off?  A test would be nice, too.\n\n-- \nEric Wong\n"},{"id":"151603","messageId":"1285386710-27905-1-git-send-email-stevenrwalter@gmail.com","threadId":"25217","inReplyTo":"20100924162704.GA4513@dcvr.yhbt.net","subject":"[PATCH] git-svn: allow the mergeinfo property to be set","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2010-09-25T03:51:50Z","receivedAt":"2010-09-25T03:51:50Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"As a first step towards preserving merges across dcommit, we need a\nmechanism to update the svn:mergeinfo property.\n\nSigned-off-by: Steven Walter <stevenrwalter@gmail.com>\n---\n git-svn.perl                 |   15 ++++++++++++++-\n t/t9157-git-svn-mergeinfo.sh |   39 +++++++++++++++++++++++++++++++++++++++\n 2 files changed, 53 insertions(+), 1 deletions(-)\n create mode 100644 t/t9157-git-svn-mergeinfo.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex c7c4dcd..1612fd7 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -83,7 +83,7 @@ my ($_stdin, $_help, $_edit,\n \t$_version, $_fetch_all, $_no_rebase, $_fetch_parent,\n \t$_merge, $_strategy, $_dry_run, $_local,\n \t$_prefix, $_no_checkout, $_url, $_verbose,\n-\t$_git_format, $_commit_url, $_tag);\n+\t$_git_format, $_commit_url, $_tag, $_merge_info);\n $Git::SVN::_follow_parent = 1;\n $_q ||= 0;\n my %remote_opts = ( 'username=s' => \\$Git::SVN::Prompt::_username,\n@@ -153,6 +153,7 @@ my %cmd = (\n \t\t\t  'commit-url=s' => \\$_commit_url,\n \t\t\t  'revision|r=i' => \\$_revision,\n \t\t\t  'no-rebase' => \\$_no_rebase,\n+\t\t\t  'mergeinfo=s' => \\$_merge_info,\n \t\t\t%cmt_opts, %fc_opts } ],\n \tbranch => [ \\&cmd_branch,\n \t            'Create a branch in the SVN repository',\n@@ -568,6 +569,7 @@ sub cmd_dcommit {\n \t\t\t                       print \"Committed r$_[0]\\n\";\n \t\t\t                       $cmt_rev = $_[0];\n \t\t\t                },\n+\t\t\t\t\tmergeinfo => $_merge_info,\n \t\t\t                svn_path => '');\n \t\t\tif (!SVN::Git::Editor->new(\\%ed_opts)->apply_diff) {\n \t\t\t\tprint \"No changes\\n$d~1 == $d\\n\";\n@@ -4449,6 +4451,7 @@ sub new {\n \t$self->{path_prefix} = length $self->{svn_path} ?\n \t                       \"$self->{svn_path}/\" : '';\n \t$self->{config} = $opts->{config};\n+\t$self->{mergeinfo} = $opts->{mergeinfo};\n \treturn $self;\n }\n \n@@ -4758,6 +4761,11 @@ sub change_file_prop {\n \t$self->SUPER::change_file_prop($fbat, $pname, $pval, $self->{pool});\n }\n \n+sub change_dir_prop {\n+\tmy ($self, $pbat, $pname, $pval) = @_;\n+\t$self->SUPER::change_dir_prop($pbat, $pname, $pval, $self->{pool});\n+}\n+\n sub _chg_file_get_blob ($$$$) {\n \tmy ($self, $fbat, $m, $which) = @_;\n \tmy $fh = $::_repository->temp_acquire(\"git_blob_$which\");\n@@ -4851,6 +4859,11 @@ sub apply_diff {\n \t\t\tfatal(\"Invalid change type: $f\");\n \t\t}\n \t}\n+\n+\tif (defined($self->{mergeinfo})) {\n+\t\t$self->change_dir_prop($self->{bat}{''}, \"svn:mergeinfo\",\n+\t\t\t               $self->{mergeinfo});\n+\t}\n \t$self->rmdirs if $_rmdir;\n \tif (@$mods == 0) {\n \t\t$self->abort_edit;\ndiff --git a/t/t9157-git-svn-mergeinfo.sh b/t/t9157-git-svn-mergeinfo.sh\nnew file mode 100644\nindex 0000000..8337e44\n--- /dev/null\n+++ b/t/t9157-git-svn-mergeinfo.sh\n@@ -0,0 +1,39 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2010 Steven Walter\n+#\n+\n+test_description='git svn mergeinfo propagation'\n+\n+. ./lib-git-svn.sh\n+\n+say 'define NO_SVN_TESTS to skip git svn tests'\n+\n+test_expect_success \\\n+    'initialize source svn repo' '\n+        svn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n+        svn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n+        cd \"$SVN_TREE\" &&\n+        touch foo &&\n+        svn_cmd add foo &&\n+        svn_cmd commit -m \"initial commit\" &&\n+        cd .. &&\n+        rm -rf \"$SVN_TREE\"'\n+\n+test_expect_success \\\n+    'clone svn repo' '\n+        git svn init \"$svnrepo\"/trunk &&\n+        git svn fetch'\n+\n+test_expect_success \\\n+    'change svn:mergeinfo' '\n+        touch bar &&\n+        git add bar &&\n+        git commit -m \"bar\" &&\n+        git svn dcommit --mergeinfo=\"/branches/foo:1-10\"'\n+\n+test_expect_success \\\n+    'verify svn:mergeinfo' '\n+        [ `svn_cmd propget svn:mergeinfo \"$svnrepo\"/trunk` == \"/branches/foo:1-10\" ]'\n+\n+test_done\n-- \n1.6.3.3\n"},{"id":"151606","messageId":"20100925042457.GA28899@dcvr.yhbt.net","threadId":"25217","inReplyTo":"1285386710-27905-1-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH] git-svn: allow the mergeinfo property to be set","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-09-25T04:24:57Z","receivedAt":"2010-09-25T04:24:57Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Steven Walter <stevenrwalter@gmail.com> wrote:\n> As a first step towards preserving merges across dcommit, we need a\n> mechanism to update the svn:mergeinfo property.\n> \n> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n\nThanks Steven,\n\nI fixed a bashism and style issues in test case, but nonetheless acked\nand pushed it out to git://git.bogomips.org/git-svn along with a few\nothers I had forgotten to tell Junio about while I was on vacation:\n\nEric Wong (1):\n      Documentation/git-svn: discourage \"noMetadata\"\n\nMathias Lafeldt (1):\n      git-svn: fix processing of decorated commit hashes\n\nSteven Walter (2):\n      git-svn: check_cherry_pick should exclude commits already in our history\n      git-svn: allow the mergeinfo property to be set\n\n-- \nEric Wong\n"},{"id":"152488","messageId":"4CA9889E.1020604@debugon.org","threadId":"25217","inReplyTo":"20100925042457.GA28899@dcvr.yhbt.net","subject":"Re: [PATCH] git-svn: allow the mergeinfo property to be set","fromName":"Mathias Lafeldt","fromEmail":"misfire@debugon.org","sentAt":"2010-10-04T07:56:14Z","receivedAt":"2010-10-04T07:56:14Z","isPatch":true,"sender":{"key":"misfire@debugon.org","avatar":"https://avatars.githubusercontent.com/u/158074?v=4"},"body":"Eric Wong wrote:\n> Steven Walter <stevenrwalter@gmail.com> wrote:\n>> As a first step towards preserving merges across dcommit, we need a\n>> mechanism to update the svn:mergeinfo property.\n>>\n>> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n> \n> Thanks Steven,\n> \n> I fixed a bashism and style issues in test case, but nonetheless acked\n> and pushed it out to git://git.bogomips.org/git-svn along with a few\n> others I had forgotten to tell Junio about while I was on vacation:\n> \n> Eric Wong (1):\n>       Documentation/git-svn: discourage \"noMetadata\"\n> \n> Mathias Lafeldt (1):\n>       git-svn: fix processing of decorated commit hashes\n> \n> Steven Walter (2):\n>       git-svn: check_cherry_pick should exclude commits already in our history\n>       git-svn: allow the mergeinfo property to be set\n> \n\nSo, is Junio aware of those patches? Or is it better to resubmit my fix\nseparately?\n\n-Mathias\n"},{"id":"152549","messageId":"7vhbh197ut.fsf@alter.siamese.dyndns.org","threadId":"25217","inReplyTo":"4CA9889E.1020604@debugon.org","subject":"Re: [PATCH] git-svn: allow the mergeinfo property to be set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-10-04T17:38:02Z","receivedAt":"2010-10-04T17:38:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mathias Lafeldt <misfire@debugon.org> writes:\n\n>> I fixed a bashism and style issues in test case, but nonetheless acked\n>> and pushed it out to git://git.bogomips.org/git-svn along with a few\n>> others I had forgotten to tell Junio about while I was on vacation:\n>> \n>> Eric Wong (1):\n>>       Documentation/git-svn: discourage \"noMetadata\"\n>> \n>> Mathias Lafeldt (1):\n>>       git-svn: fix processing of decorated commit hashes\n>> \n>> Steven Walter (2):\n>>       git-svn: check_cherry_pick should exclude commits already in our history\n>>       git-svn: allow the mergeinfo property to be set\n>> \n>\n> So, is Junio aware of those patches? Or is it better to resubmit my fix\n> separately?\n\nNow I am ;-)  Thanks for reminding me.\n\nI found these four near Eric's 'master':\n\n  833fde5 git-svn: allow the mergeinfo property to be set\n  8565a56 git-svn: fix processing of decorated commit hashes\n  a3c7505 git-svn: check_cherry_pick should exclude commits already in our history\n  c9be27f Documentation/git-svn: discourage \"noMetadata\"\n\nThey all (perhaps except the very tip one) look fixes not enhancements, so\nI'll merge it to 'maint', so it can appear in 'master' and also in 1.7.3.2\nin due course.\n\nIf 833fde5 needs to be excluded from 'maint', please advise.\n"},{"id":"152605","messageId":"20101004220558.GA29932@dcvr.yhbt.net","threadId":"25217","inReplyTo":"7vhbh197ut.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: allow the mergeinfo property to be set","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-10-04T22:05:58Z","receivedAt":"2010-10-04T22:05:58Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> I found these four near Eric's 'master':\n> \n>   833fde5 git-svn: allow the mergeinfo property to be set\n>   8565a56 git-svn: fix processing of decorated commit hashes\n>   a3c7505 git-svn: check_cherry_pick should exclude commits already in our history\n>   c9be27f Documentation/git-svn: discourage \"noMetadata\"\n> \n> They all (perhaps except the very tip one) look fixes not enhancements, so\n> I'll merge it to 'maint', so it can appear in 'master' and also in 1.7.3.2\n> in due course.\n> \n> If 833fde5 needs to be excluded from 'maint', please advise.\n\nYes, 833fde5 is an enhancement so it should be left out of 'maint'.\n\nIn the future, I suppose I could maintain my own 'maint' branch to make\nyour life easier.\n\n-- \nEric Wong\n"}]}