git-svn: Teach dcommit --mergeinfo to handle multiple lines

"svn dcommit --mergeinfo" replaces the svn:mergeinfo property in an upstream SVN repository with the given text. The svn:mergeinfo property may contain commits originating on multiple branches, separated by newlines. Cause space characters in the mergeinfo to be replaced by newlines, allowing a user to create history representing multiple branches being merged into one. Update the corresponding documentation and add a test for the new functionality. Signed-off-by: Bryan Jacobs <bjacobs@woti.com> Acked-by: Sam Vilain <sam@vilain.net> Acked-by: Eric Wong <normalperson@yhbt.net>

Bryan Jacobs committed Aug 31, 2011 at 12:48 UTC 98c4ab32f80d00d0254bfdcab8d934dcda6a7504
3 files changed +19 -2
Documentation/git-svn.txt
+3 -2
@@ -222,8 +222,9 @@ discouraged.
222 Add the given merge information during the dcommit
223 (e.g. `--mergeinfo="/branches/foo:1-10"`). All svn server versions can
224 store this information (as a property), and svn clients starting from
225 - version 1.5 can make use of it. 'git svn' currently does not use it
226 - and does not set it automatically.
225 + version 1.5 can make use of it. To specify merge information from multiple
226 + branches, use a single space character between the branches
227 + (`--mergeinfo="/branches/foo:1-10 /branches/bar:3,5-6,8"`)
228
229 'branch'::
230 Create a branch in the SVN repository.
git-svn.perl
+3
@@ -559,6 +559,9 @@ sub cmd_dcommit {
559 }
560 my $expect_url = $url;
561 Git::SVN::remove_username($expect_url);
562 + if (defined($_merge_info)) {
563 + $_merge_info =~ tr{ }{\n};
564 + }
565 while (1) {
566 my $d = shift @$linear_refs or last;
567 unless (defined $last_rev) {
t/t9158-git-svn-mergeinfo.sh
+13
@@ -38,4 +38,17 @@ test_expect_success 'verify svn:mergeinfo' '
38 test "$mergeinfo" = "/branches/foo:1-10"
39 '
40
41 +test_expect_success 'change svn:mergeinfo multiline' '
42 + touch baz &&
43 + git add baz &&
44 + git commit -m "baz" &&
45 + git svn dcommit --mergeinfo="/branches/bar:1-10 /branches/other:3-5,8,10-11"
46 +'
47 +
48 +test_expect_success 'verify svn:mergeinfo multiline' '
49 + mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk)
50 + test "$mergeinfo" = "/branches/bar:1-10
51 +/branches/other:3-5,8,10-11"
52 +'
53 +
54 test_done