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>
This commit is contained in:
Bryan Jacobs 2011-08-31 12:48:39 -04:00 коммит произвёл Eric Wong
Родитель 85f022e9c1
Коммит 98c4ab32f8
3 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -222,8 +222,9 @@ discouraged.
Add the given merge information during the dcommit Add the given merge information during the dcommit
(e.g. `--mergeinfo="/branches/foo:1-10"`). All svn server versions can (e.g. `--mergeinfo="/branches/foo:1-10"`). All svn server versions can
store this information (as a property), and svn clients starting from 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 version 1.5 can make use of it. To specify merge information from multiple
and does not set it automatically. branches, use a single space character between the branches
(`--mergeinfo="/branches/foo:1-10 /branches/bar:3,5-6,8"`)
'branch':: 'branch'::
Create a branch in the SVN repository. Create a branch in the SVN repository.

Просмотреть файл

@ -559,6 +559,9 @@ sub cmd_dcommit {
} }
my $expect_url = $url; my $expect_url = $url;
Git::SVN::remove_username($expect_url); Git::SVN::remove_username($expect_url);
if (defined($_merge_info)) {
$_merge_info =~ tr{ }{\n};
}
while (1) { while (1) {
my $d = shift @$linear_refs or last; my $d = shift @$linear_refs or last;
unless (defined $last_rev) { unless (defined $last_rev) {

Просмотреть файл

@ -38,4 +38,17 @@ test_expect_success 'verify svn:mergeinfo' '
test "$mergeinfo" = "/branches/foo:1-10" 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 test_done