git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Teach dcommit --mergeinfo to handle multiple lines

From
BJBryan Jacobs <bjacobs@woti.com>
Date
Aug 31, 2011, 16:48 UTC
Message-ID
<20110831124839.69c70486@robyn.woti.com>

"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>
---
 Documentation/git-svn.txt    |    5 +++--
 git-svn.perl                 |    3 +++
 t/t9158-git-svn-mergeinfo.sh |   13 +++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index ed5eca1..3ed28df 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -211,8 +211,9 @@ discouraged.
 	Add the given merge information during the dcommit
 	(e.g. `--mergeinfo="/branches/foo:1-10"`). All svn server versions can
 	store this information (as a property), and svn clients starting from
-	version 1.5 can make use of it. 'git svn' currently does not use it
-	and does not set it automatically.
+	version 1.5 can make use of it. To specify merge information from multiple
+	branches, use a single space character between the branches
+	(`--mergeinfo="/branches/foo:1-10 /branches/bar:3,5-6,8"`)
 
 'branch'::
 	Create a branch in the SVN repository.
diff --git a/git-svn.perl b/git-svn.perl
index 89f83fd..3ee26a2 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -548,6 +548,9 @@ sub cmd_dcommit {
 	}
 	my $expect_url = $url;
 	Git::SVN::remove_username($expect_url);
+	if (defined($_merge_info)) {
+		$_merge_info =~ tr{ }{\n};
+	}
 	while (1) {
 		my $d = shift @$linear_refs or last;
 		unless (defined $last_rev) {
diff --git a/t/t9158-git-svn-mergeinfo.sh b/t/t9158-git-svn-mergeinfo.sh
index 3ab4390..8c9539e 100755
--- a/t/t9158-git-svn-mergeinfo.sh
+++ b/t/t9158-git-svn-mergeinfo.sh
@@ -38,4 +38,17 @@ test_expect_success 'verify svn:mergeinfo' '
 	test "$mergeinfo" = "/branches/foo:1-10"
 '
 
+test_expect_success 'change svn:mergeinfo multiline' '
+	touch baz &&
+	git add baz &&
+	git commit -m "baz" &&
+	git svn dcommit --mergeinfo="/branches/bar:1-10 /branches/other:3-5,8,10-11"
+'
+
+test_expect_success 'verify svn:mergeinfo multiline' '
+	mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk)
+	test "$mergeinfo" = "/branches/bar:1-10
+/branches/other:3-5,8,10-11"
+'
+
 test_done
-- 
1.7.6
Next: Eric Wong
Message 1 of 7 in “Teach dcommit --mergeinfo to handle multiple lines”
  1. Teach dcommit --mergeinfo to handle multiple linesBryan Jacobs, Aug 31, 2011
  2. Eric WongAug 31, 2011
  3. Sam VilainAug 31, 2011
  4. Bryan JacobsAug 31, 2011
  5. Sam VilainAug 31, 2011
  6. Eric WongSep 1, 2011
  7. Sam VilainSep 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.