All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Teach dcommit --mergeinfo to handle multiple lines
@ 2011-08-31 16:48 Bryan Jacobs
  2011-08-31 20:21 ` Eric Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Bryan Jacobs @ 2011-08-31 16:48 UTC (permalink / raw)
  To: git

"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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Teach dcommit --mergeinfo to handle multiple lines
  2011-08-31 16:48 [PATCH] Teach dcommit --mergeinfo to handle multiple lines Bryan Jacobs
@ 2011-08-31 20:21 ` Eric Wong
  2011-08-31 20:43   ` [spf:guess] " Sam Vilain
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2011-08-31 20:21 UTC (permalink / raw)
  To: Bryan Jacobs; +Cc: git, Sam Vilain

Subsystem commit subjects should be prefixed with the approriate
subsystem (e.g. "git-svn: Teach dcommit --mergeinfo ..."

Bryan Jacobs <bjacobs@woti.com> wrote:
> "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>

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

> ---
>  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [spf:guess] Re: [PATCH] Teach dcommit --mergeinfo to handle multiple lines
  2011-08-31 20:21 ` Eric Wong
@ 2011-08-31 20:43   ` Sam Vilain
  2011-08-31 20:51     ` Bryan Jacobs
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Vilain @ 2011-08-31 20:43 UTC (permalink / raw)
  To: Eric Wong; +Cc: Bryan Jacobs, git

On 8/31/11 1:21 PM, Eric Wong wrote:
>> --- 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"`)

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [spf:guess] Re: [PATCH] Teach dcommit --mergeinfo to handle multiple lines
  2011-08-31 20:43   ` [spf:guess] " Sam Vilain
@ 2011-08-31 20:51     ` Bryan Jacobs
  2011-08-31 22:15       ` [spf:guess,iffy] " Sam Vilain
  0 siblings, 1 reply; 7+ messages in thread
From: Bryan Jacobs @ 2011-08-31 20:51 UTC (permalink / raw)
  To: Sam Vilain; +Cc: Eric Wong, git

On Wed, 31 Aug 2011 13:43:39 -0700
Sam Vilain <sam@vilain.net> wrote:

> On 8/31/11 1:21 PM, Eric Wong wrote:
> >> --- 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"`)
> 
> 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.

> 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.

> Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [spf:guess,iffy] Re: [spf:guess] Re: [PATCH] Teach dcommit --mergeinfo to handle multiple lines
  2011-08-31 20:51     ` Bryan Jacobs
@ 2011-08-31 22:15       ` Sam Vilain
  2011-09-01  1:37         ` Eric Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Vilain @ 2011-08-31 22:15 UTC (permalink / raw)
  To: Bryan Jacobs; +Cc: Eric Wong, git

On 8/31/11 1:51 PM, Bryan Jacobs wrote:
> ...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.
>> 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.
>

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Teach dcommit --mergeinfo to handle multiple lines
  2011-08-31 22:15       ` [spf:guess,iffy] " Sam Vilain
@ 2011-09-01  1:37         ` Eric Wong
  2011-09-01  4:40           ` [spf:guess] " Sam Vilain
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2011-09-01  1:37 UTC (permalink / raw)
  To: Sam Vilain; +Cc: Bryan Jacobs, git

Sam Vilain <sam@vilain.net> wrote:
> 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?

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [spf:guess] Re: [PATCH] Teach dcommit --mergeinfo to handle multiple lines
  2011-09-01  1:37         ` Eric Wong
@ 2011-09-01  4:40           ` Sam Vilain
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Vilain @ 2011-09-01  4:40 UTC (permalink / raw)
  To: Eric Wong; +Cc: Bryan Jacobs, git

On 31/08/11 18:37, Eric Wong wrote:
> Sam Vilain <sam@vilain.net> wrote:
>> 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?

Acked-by: Sam Vilain <sam@vilain.net>

Cheers,
Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-09-01  4:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-31 16:48 [PATCH] Teach dcommit --mergeinfo to handle multiple lines Bryan Jacobs
2011-08-31 20:21 ` Eric Wong
2011-08-31 20:43   ` [spf:guess] " Sam Vilain
2011-08-31 20:51     ` Bryan Jacobs
2011-08-31 22:15       ` [spf:guess,iffy] " Sam Vilain
2011-09-01  1:37         ` Eric Wong
2011-09-01  4:40           ` [spf:guess] " Sam Vilain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.