Teach dcommit --mergeinfo to handle multiple lines
PATCH 1/1 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.
--- Documentation/git-svn.txt | 5 +++-- git-svn.perl | 3 +++ t/t9158-git-svn-mergeinfo.sh | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-)
Documentation/git-svn.txt +3 -2
@@ -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.
git-svn.perl +3 -0
@@ -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) {
t/t9158-git-svn-mergeinfo.sh +13 -0
@@ -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
Signature · 1 line
1.7.6
Subsystem commit subjects should be prefixed with the approriate subsystem (e.g. "git-svn: Teach dcommit --mergeinfo ..."
Quoted 5 lines · Bryan Jacobs
"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.
Quoted 8 lines
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 <[email protected]>
This looks reasonable, Cc:-ing Sam since he handled the mergeinfo stuff. After all this time, I still have no experience using SVN mergeinfo anywhere :x
Quoted 60 lines
--- Documentation/git-svn.txt | 5 +++-- git-svn.perl | 3 +++ t/t9158-git-svn-mergeinfo.sh | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-)Documentation/git-svn.txt +3
-2@@ -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.git-svn.perl +3
-0@@ -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) {t/t9158-git-svn-mergeinfo.sh +13
-0@@ -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_doneSignature · 1 line
1.7.6
Quoted 11 lines · Eric Wong
Documentation/git-svn.txt discouraged. · line 216
Quoted 11 lines
Documentation/git-svn.txt +3
-2@@ -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"`)
This interface seems regrettably stupid. Like, do I need to consider the existing revisions that are already listed in the property? Is it really impossible to derive the changes that were merged and generate the list automatically?
But so long as it makes something previously impossible possible, it is a good change - my feeling is that it should be called something like --mergeinfo-raw or --mergeinfo-set to leave room for a possible --mergeinfo-add which knows how the lists work and adds them (which is what I'd expect a plain --mergeinfo switch to do).
Sam
Quoted 13 lines · On Wed, 31 Aug 2011 13:43:39 -0700 Sam Vilain <[email protected]> wrote:
Quoted 12 lines · Eric Wong
Quoted 12 lines
Documentation/git-svn.txt +0
-0@@ -211,8 +211,9 @@ discouraged. Add the given merge information during the dcommit (e.g. `--mergeinfo="/branches/foo:1-10"`). All svnserver versions can store this information (as a property), and svn clients starting from
Documentation/git-svn.txt +0
-1- version 1.5 can make use of it. 'git svn' currently doesnot use it
Documentation/git-svn.txt +1
-1- and does not set it automatically. + version 1.5 can make use of it. To specify mergeinformation from multiple
Quoted 8 lines
Quoted 3 lines
Documentation/git-svn.txt discouraged. · line 216
Quoted 3 lines
Documentation/git-svn.txt +1
-0+ branches, use a single space character between thebranches
Documentation/git-svn.txt +1
-0+ (`--mergeinfo="/branches/foo:1-10 /branches/bar:3,5-6,8"`)This interface seems regrettably stupid. Like, do I need to consider the existing revisions that are already listed in the property? Is it really impossible to derive the changes that were merged and generate the list automatically?
Nope, it's possible. I didn't create the original --mergeinfo interface. I was very surprised when I first discovered it clobbered instead of integrating - it's easy to nuke your SVN repo's ability to merge with one careless use of this option. See below.
Quoted 5 lines
But so long as it makes something previously impossible possible, it is a good change - my feeling is that it should be called something like --mergeinfo-raw or --mergeinfo-set to leave room for a possible --mergeinfo-add which knows how the lists work and adds them (which is what I'd expect a plain --mergeinfo switch to do).
I completely agree. I think there should at least be a --mergeinfo-update which fetches the current revision, merges that with the provided set using the branch paths as keys (and compacts using svn:mergeinfo rules), and sets the property to the final result.
I actually do this currently with external scripts, which is why I wanted to make --mergeinfo capable of delivering my final payload. It would make my life easier if all the logic were part of git-svn instead.
That said, this change is really small. That change would be larger. So I submitted this first.
Quoted 1 line
Sam
Quoted 13 lines · Bryan Jacobs
...I didn't create the original --mergeinfo interface. I was very surprised when I first discovered it clobbered instead of integrating
- it's easy to nuke your SVN repo's ability to merge with one careless
use of this option. See below.Quoted 5 lines
But so long as it makes something previously impossible possible, it is a good change - my feeling is that it should be called something like --mergeinfo-raw or --mergeinfo-set to leave room for a possible --mergeinfo-add which knows how the lists work and adds them (which is what I'd expect a plain --mergeinfo switch to do).
I completely agree. I think there should at least be a --mergeinfo-update which fetches the current revision, merges that with the provided set using the branch paths as keys (and compacts using svn:mergeinfo rules), and sets the property to the final result.
Quoted 7 lines
I actually do this currently with external scripts, which is why I wanted to make --mergeinfo capable of delivering my final payload. It would make my life easier if all the logic were part of git-svn instead.
That said, this change is really small. That change would be larger. So I submitted this first.
Ok, well I guess this is a useful intermediate feature then. Feel free to copy in any further changes you may come up with in this area to me, if you decide to do that.
Cheers,
Sam
Quoted 3 lines · Sam Vilain
Ok, well I guess this is a useful intermediate feature then. Feel free to copy in any further changes you may come up with in this area to me, if you decide to do that.
Shall I consider this an Acked-by?
Signature · 1 line
Eric Wong
Sam Vilain
Acked-byQuoted 5 lines · Eric Wong
Quoted 3 lines · Sam Vilain
Ok, well I guess this is a useful intermediate feature then. Feel free to copy in any further changes you may come up with in this area to me, if you decide to do that.
Shall I consider this an Acked-by?
Cheers,
Sam