# [PATCH] git-svn: try to read the dcommit url from the config file

10 messages from 2009-02-19 to 2009-02-23. Participants: Peter Oberndorfer, Kevin Menard, Eric Wong, Junio C Hamano.
Thread: https://gitlist.dev/t/17905

## Peter Oberndorfer, 2009-02-19 18:30

Subject: [PATCH] git-svn: try to read the dcommit url from the config file
Message-ID: <200902191930.10139.kumbayo84@arcor.de>
URL: https://gitlist.dev/e/200902191930.10139.kumbayo84%40arcor.de

```
The commit url is determined in the following order
--commit-url commandline
svn-remote.<name>.dcommiturl
svn-remote.<name>.url

Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
---

I find it really boring to always specify --commit-url on the git svn dcommit command line.
And it tends to fall out of my bash_history since i do not commit often.
Setting up the commit url 1 time should be enough.

I feel that the config key: part im the documentation should get more exposure or explanation.
Maybe somebody can suggest some wording?

Also the dcommiturl name is still a suggestion

My kdelibs git-svn config file no looks like this:

[svn-remote "svn"]
	url = svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
	fetch = :refs/remotes/git-svn
	dcommiturl = svn+ssh://username@svn.kde.org/home/kde/trunk/KDE/kdelibs


 Documentation/git-svn.txt |    2 ++
 git-svn.perl              |   12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 3d45654..0d11428 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -169,6 +169,8 @@ and have no uncommitted changes.
 	reused if a user is later given access to an alternate transport
 	method (e.g. `svn+ssh://` or `https://`) for commit.
 
+config key: svn-remote.<name>.dcommiturl
+
 	Using this option for any other purpose (don't ask)
 	is very strongly discouraged.
 --
diff --git a/git-svn.perl b/git-svn.perl
index 83cb36f..2ad3603 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -438,7 +438,17 @@ sub cmd_dcommit {
 		die "Unable to determine upstream SVN information from ",
 		    "$head history.\nPerhaps the repository is empty.";
 	}
-	$url = defined $_commit_url ? $_commit_url : $gs->full_url;
+
+	if (defined $_commit_url) {
+		$url = $_commit_url;
+	} else {
+		$url = eval { command_oneline('config', '--get',
+			      "svn-remote.$gs->{repo_id}.dcommiturl") };
+		if (!$url) {
+			$url = $gs->full_url
+		}
+	}
+
 	my $last_rev = $_revision if defined $_revision;
 	if ($url) {
 		print "Committing to $url ...\n";
-- 
1.6.1.3

```

## Peter Oberndorfer, 2009-02-19 18:47

Subject: git svn dcommit difficulties/feature request
Message-ID: <200902191947.22622.kumbayo84@arcor.de>
URL: https://gitlist.dev/e/200902191947.22622.kumbayo84%40arcor.de
In-Reply-To: <200902191930.10139.kumbayo84@arcor.de>

```
Hi,

With the patch i am replying to git-svn got a bit more comfortable for me but 
there is still a problem left.

I fetch via svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
and push to svn+ssh://YOUR_LOGIN@svn.kde.org/home/kde/trunk/KDE/kdelibs

Pushing multiple changes at once to KDE servers with different fetch/commit 
url is not possible for me.

Here is what it think what happens during a push:
git svn dcommit pushes the first commit to svn.kde.org,
then tries to fetch what it just pushed from anonsvn.kde.org
(which lags behind authenticated svn by a few minutes).

git svn does not see the just committed changes, gets confused
and stops pushing the rest of the commits.

My idea would be to temporarily fetch from the authenticated server, but not 
update the current head and revdb., so nothing is affected beside the push.
But this seems quite complicated.
Or do not care about difference between fetch/dcommit url, and just fetch from 
the dcommit url during dcommit.

Anybody have a good idea if this is possible or a better way to solve this 
problem?

Greetings Peter

```

## Kevin Menard, 2009-02-20 12:59

Subject: Re: git svn dcommit difficulties/feature request
Message-ID: <7e3605160902200459x50e56c92x462d9a072eaa84d0@mail.gmail.com>
URL: https://gitlist.dev/e/7e3605160902200459x50e56c92x462d9a072eaa84d0%40mail.gmail.com
In-Reply-To: <200902191947.22622.kumbayo84@arcor.de>

```
We've run into the same issue with the experimental git support at the
ASF.  We dcommit to an EU mirror which lags behind the primary one for
a couple minutes.  While annoying, I don't think there's much that can
be done other than to commit and read from the master SVN server.
Otherwise, plan on getting good at "git svn dcommit; git svn rebase".
I tolerate this step because I think using git on top of SVN, even
with this lag, makes me more productive than SVN alone.

-- 
Kevin



On Thu, Feb 19, 2009 at 1:47 PM, Peter Oberndorfer <kumbayo84@arcor.de> wrote:
> Hi,
>
> With the patch i am replying to git-svn got a bit more comfortable for me but
> there is still a problem left.
>
> I fetch via svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
> and push to svn+ssh://YOUR_LOGIN@svn.kde.org/home/kde/trunk/KDE/kdelibs
>
> Pushing multiple changes at once to KDE servers with different fetch/commit
> url is not possible for me.
>
> Here is what it think what happens during a push:
> git svn dcommit pushes the first commit to svn.kde.org,
> then tries to fetch what it just pushed from anonsvn.kde.org
> (which lags behind authenticated svn by a few minutes).
>
> git svn does not see the just committed changes, gets confused
> and stops pushing the rest of the commits.
>
> My idea would be to temporarily fetch from the authenticated server, but not
> update the current head and revdb., so nothing is affected beside the push.
> But this seems quite complicated.
> Or do not care about difference between fetch/dcommit url, and just fetch from
> the dcommit url during dcommit.
>
> Anybody have a good idea if this is possible or a better way to solve this
> problem?
>
> Greetings Peter
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

```

## Eric Wong, 2009-02-21 12:08

Subject: Re: [PATCH] git-svn: try to read the dcommit url from the config file
Message-ID: <20090221120815.GA8145@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20090221120815.GA8145%40dcvr.yhbt.net
In-Reply-To: <200902191930.10139.kumbayo84@arcor.de>

```
Peter Oberndorfer <kumbayo84@arcor.de> wrote:
> The commit url is determined in the following order
> --commit-url commandline

actually, it should look in the .git/config for this, too:

  svn.commiturl

> svn-remote.<name>.dcommiturl

Of course, having a per-svn-remote commiturl can be useful, too.

Though I'd call it "commiturl" instead of "dcommiturl" to match the
existing config setting.  The not-often-used "set-tree" command could
probably be updated to use these config options, too...

I'll ack this patch with "dcommiturl" replaced with "commiturl".

> svn-remote.<name>.url
> 
> Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
> ---
> 
> I find it really boring to always specify --commit-url on the git svn dcommit command line.
> And it tends to fall out of my bash_history since i do not commit often.
> Setting up the commit url 1 time should be enough.
> 
> I feel that the config key: part im the documentation should get more exposure or explanation.
> Maybe somebody can suggest some wording?
> 
> Also the dcommiturl name is still a suggestion
> 
> My kdelibs git-svn config file no looks like this:
> 
> [svn-remote "svn"]
> 	url = svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
> 	fetch = :refs/remotes/git-svn
> 	dcommiturl = svn+ssh://username@svn.kde.org/home/kde/trunk/KDE/kdelibs
> 
> 
>  Documentation/git-svn.txt |    2 ++
>  git-svn.perl              |   12 +++++++++++-
>  2 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 3d45654..0d11428 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -169,6 +169,8 @@ and have no uncommitted changes.
>  	reused if a user is later given access to an alternate transport
>  	method (e.g. `svn+ssh://` or `https://`) for commit.
>  
> +config key: svn-remote.<name>.dcommiturl
> +
>  	Using this option for any other purpose (don't ask)
>  	is very strongly discouraged.
>  --
> diff --git a/git-svn.perl b/git-svn.perl
> index 83cb36f..2ad3603 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -438,7 +438,17 @@ sub cmd_dcommit {
>  		die "Unable to determine upstream SVN information from ",
>  		    "$head history.\nPerhaps the repository is empty.";
>  	}
> -	$url = defined $_commit_url ? $_commit_url : $gs->full_url;
> +
> +	if (defined $_commit_url) {
> +		$url = $_commit_url;
> +	} else {
> +		$url = eval { command_oneline('config', '--get',
> +			      "svn-remote.$gs->{repo_id}.dcommiturl") };
> +		if (!$url) {
> +			$url = $gs->full_url
> +		}
> +	}
> +
>  	my $last_rev = $_revision if defined $_revision;
>  	if ($url) {
>  		print "Committing to $url ...\n";
> -- 
> 1.6.1.3

```

## Eric Wong, 2009-02-21 12:12

Subject: Re: git svn dcommit difficulties/feature request
Message-ID: <20090221121253.GB8145@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20090221121253.GB8145%40dcvr.yhbt.net
In-Reply-To: <200902191947.22622.kumbayo84@arcor.de>

```
Peter Oberndorfer <kumbayo84@arcor.de> wrote:
> Hi,
> 
> With the patch i am replying to git-svn got a bit more comfortable for me but 
> there is still a problem left.
> 
> I fetch via svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs
> and push to svn+ssh://YOUR_LOGIN@svn.kde.org/home/kde/trunk/KDE/kdelibs
> 
> Pushing multiple changes at once to KDE servers with different fetch/commit 
> url is not possible for me.
> 
> Here is what it think what happens during a push:
> git svn dcommit pushes the first commit to svn.kde.org,
> then tries to fetch what it just pushed from anonsvn.kde.org
> (which lags behind authenticated svn by a few minutes).
> 
> git svn does not see the just committed changes, gets confused
> and stops pushing the rest of the commits.
> 
> My idea would be to temporarily fetch from the authenticated server, but not 
> update the current head and revdb., so nothing is affected beside the push.
> But this seems quite complicated.
> Or do not care about difference between fetch/dcommit url, and just fetch from 
> the dcommit url during dcommit.
> 
> Anybody have a good idea if this is possible or a better way to solve this 
> problem?

You could probably look into how rewriteRoot works and set that on a
temporary basis in memory.  In fact, that should probably be a default
when using --commit-url iny any form...

-- 
Eric Wong

```

## Peter Oberndorfer, 2009-02-22 21:41

Subject: Re: [PATCH] git-svn: try to read the dcommit url from the config file
Message-ID: <200902222241.56223.kumbayo84@arcor.de>
URL: https://gitlist.dev/e/200902222241.56223.kumbayo84%40arcor.de
In-Reply-To: <20090221120815.GA8145@dcvr.yhbt.net>

```
On Samstag 21 Februar 2009, Eric Wong wrote:
> Peter Oberndorfer <kumbayo84@arcor.de> wrote:
> > The commit url is determined in the following order
> > --commit-url commandline
> 
> actually, it should look in the .git/config for this, too:
> 
>   svn.commiturl
> 

I did not see that the commandline options are also searched in the config.
Also this option does not seem to be documented.
Should i document svn.commiturl in dcommit or is that just a implementation detail.

> > svn-remote.<name>.dcommiturl
> 
> Of course, having a per-svn-remote commiturl can be useful, too.
> 
> Though I'd call it "commiturl" instead of "dcommiturl" to match the
> existing config setting.  The not-often-used "set-tree" command could
> probably be updated to use these config options, too...
> 

sorry, i do not understand enough of perl/git-svn to do this :-(

> I'll ack this patch with "dcommiturl" replaced with "commiturl".
> 

OK, will resend the patch once i know if i should document svn.commiturl.

> > svn-remote.<name>.url
> > 
> > Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
> > ---
> > 

Greetings Peter

```

## Eric Wong, 2009-02-23 02:05

Subject: Re: [PATCH] git-svn: try to read the dcommit url from the config file
Message-ID: <20090223020545.GE26706@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20090223020545.GE26706%40dcvr.yhbt.net
In-Reply-To: <200902222241.56223.kumbayo84@arcor.de>

```
Peter Oberndorfer <kumbayo84@arcor.de> wrote:
> On Samstag 21 Februar 2009, Eric Wong wrote:
> > Peter Oberndorfer <kumbayo84@arcor.de> wrote:
> > > The commit url is determined in the following order
> > > --commit-url commandline
> > 
> > actually, it should look in the .git/config for this, too:
> > 
> >   svn.commiturl
> > 
> 
> I did not see that the commandline options are also searched in the
> config.  Also this option does not seem to be documented.  Should i
> document svn.commiturl in dcommit or is that just a implementation
> detail.

Please document svn.commiturl, thanks

> > > svn-remote.<name>.dcommiturl
> > 
> > Of course, having a per-svn-remote commiturl can be useful, too.
> > 
> > Though I'd call it "commiturl" instead of "dcommiturl" to match the
> > existing config setting.  The not-often-used "set-tree" command could
> > probably be updated to use these config options, too...
> > 
> 
> sorry, i do not understand enough of perl/git-svn to do this :-(

Don't worry about set-tree, for now :) dcommit has been the recommended
workflow for a while now so very few people use set-tree (it's highly
git-centric and makes history confusing to SVN users).

> > I'll ack this patch with "dcommiturl" replaced with "commiturl".
> > 
> 
> OK, will resend the patch once i know if i should document svn.commiturl.

Thanks Peter

-- 
Eric Wong

```

## Peter Oberndorfer, 2009-02-23 11:02

Subject: [PATCH] git-svn: read the dcommit url from the config file on a per remote basis
Message-ID: <200902231202.54054.kumbayo84@arcor.de>
URL: https://gitlist.dev/e/200902231202.54054.kumbayo84%40arcor.de
In-Reply-To: <20090223020545.GE26706@dcvr.yhbt.net>

```
The commit url for dcommit is determined in the following order:
commandline option --commit-url
svn.commiturl
svn-remote.<name>.commiturl
svn-remote.<name>.url

Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
---
Now with a short documentation for svn.commiturl.
I hope the wording is OK.

 Documentation/git-svn.txt |    4 ++++
 git-svn.perl              |   12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 3d45654..cda3389 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -169,6 +169,10 @@ and have no uncommitted changes.
 	reused if a user is later given access to an alternate transport
 	method (e.g. `svn+ssh://` or `https://`) for commit.
 
+config key: svn-remote.<name>.commiturl
+
+config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
+
 	Using this option for any other purpose (don't ask)
 	is very strongly discouraged.
 --
diff --git a/git-svn.perl b/git-svn.perl
index cbc5211..be4d011 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -438,7 +438,17 @@ sub cmd_dcommit {
 		die "Unable to determine upstream SVN information from ",
 		    "$head history.\nPerhaps the repository is empty.";
 	}
-	$url = defined $_commit_url ? $_commit_url : $gs->full_url;
+
+	if (defined $_commit_url) {
+		$url = $_commit_url;
+	} else {
+		$url = eval { command_oneline('config', '--get',
+			      "svn-remote.$gs->{repo_id}.commiturl") };
+		if (!$url) {
+			$url = $gs->full_url
+		}
+	}
+
 	my $last_rev = $_revision if defined $_revision;
 	if ($url) {
 		print "Committing to $url ...\n";
-- 
1.6.1.3

```

## Eric Wong, 2009-02-23 22:45

Subject: Re: [PATCH] git-svn: read the dcommit url from the config file on a per remote basis
Message-ID: <20090223224516.GB32193@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20090223224516.GB32193%40dcvr.yhbt.net
In-Reply-To: <200902231202.54054.kumbayo84@arcor.de>

```
Peter Oberndorfer <kumbayo84@arcor.de> wrote:
> The commit url for dcommit is determined in the following order:
> commandline option --commit-url
> svn.commiturl
> svn-remote.<name>.commiturl
> svn-remote.<name>.url
> 
> Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>

> ---
> Now with a short documentation for svn.commiturl.
> I hope the wording is OK.

Thanks Peter, the wording is fine.

Acked and pushed out to git://git.bogomips.org/git-svn

>  Documentation/git-svn.txt |    4 ++++
>  git-svn.perl              |   12 +++++++++++-
>  2 files changed, 15 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> index 3d45654..cda3389 100644
> --- a/Documentation/git-svn.txt
> +++ b/Documentation/git-svn.txt
> @@ -169,6 +169,10 @@ and have no uncommitted changes.
>  	reused if a user is later given access to an alternate transport
>  	method (e.g. `svn+ssh://` or `https://`) for commit.
>  
> +config key: svn-remote.<name>.commiturl
> +
> +config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
> +
>  	Using this option for any other purpose (don't ask)
>  	is very strongly discouraged.
>  --
> diff --git a/git-svn.perl b/git-svn.perl
> index cbc5211..be4d011 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -438,7 +438,17 @@ sub cmd_dcommit {
>  		die "Unable to determine upstream SVN information from ",
>  		    "$head history.\nPerhaps the repository is empty.";
>  	}
> -	$url = defined $_commit_url ? $_commit_url : $gs->full_url;
> +
> +	if (defined $_commit_url) {
> +		$url = $_commit_url;
> +	} else {
> +		$url = eval { command_oneline('config', '--get',
> +			      "svn-remote.$gs->{repo_id}.commiturl") };
> +		if (!$url) {
> +			$url = $gs->full_url
> +		}
> +	}
> +
>  	my $last_rev = $_revision if defined $_revision;
>  	if ($url) {
>  		print "Committing to $url ...\n";
> -- 
> 1.6.1.3

```

## Junio C Hamano, 2009-02-23 23:06

Subject: Re: [PATCH] git-svn: read the dcommit url from the config file on a per remote basis
Message-ID: <7vbpssu50t.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbpssu50t.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20090223224516.GB32193@dcvr.yhbt.net>

```
Eric Wong <normalperson@yhbt.net> writes:

> Peter Oberndorfer <kumbayo84@arcor.de> wrote:
>> The commit url for dcommit is determined in the following order:
>> commandline option --commit-url
>> svn.commiturl
>> svn-remote.<name>.commiturl
>> svn-remote.<name>.url
>> 
>> Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
>
>> ---
>> Now with a short documentation for svn.commiturl.
>> I hope the wording is OK.
>
> Thanks Peter, the wording is fine.
>
> Acked and pushed out to git://git.bogomips.org/git-svn

Will pull before I'll go into the integration mode tonight for 1.6.2-rc2.
Thanks.

```
