threads / patch / 17905

patchgit-svn: try to read the dcommit url from the config file

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

## tl;dr

10 messages between Feb 19, 2009 and Feb 23, 2009. Diffs are folded; open one to read it.

replies: 9people: 4as markdown or json

Peter Oberndorfer· Feb 19, 2009, 18:30 UTC · lore

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(-)
Show changes to 2 files +13 −1

Documentation/git-svn.txt, git-svn.perl

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· Feb 19, 2009, 18:47 UTC · re: Peter Oberndorfer · lore

git svn dcommit difficulties/feature request

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· Feb 20, 2009, 12:59 UTC · re: Peter Oberndorfer · lore

Re: git svn dcommit difficulties/feature request

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· Feb 21, 2009, 12:12 UTC · re: Peter Oberndorfer · lore

Re: git svn dcommit difficulties/feature request

Peter Oberndorfer <kumbayo84@arcor.de> wrote:
Show 27 quoted lines
> 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
Eric Wong· Feb 21, 2009, 12:08 UTC · re: Peter Oberndorfer · lore

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

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".
Show 64 quoted lines
> 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· Feb 22, 2009, 21:41 UTC · re: Eric Wong · lore

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

On Samstag 21 Februar 2009, Eric Wong wrote:
Show 8 quoted lines
> 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.

Show 8 quoted lines
> > 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.
Show 5 quoted lines
> > svn-remote.<name>.url
> > 
> > Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
> > ---
> > 
Greetings Peter
Eric Wong· Feb 23, 2009, 02:05 UTC · re: Peter Oberndorfer · lore

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

Peter Oberndorfer <kumbayo84@arcor.de> wrote:
Show 14 quoted lines
> 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
Show 10 quoted lines
> > > 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· Feb 23, 2009, 11:02 UTC · re: Eric Wong · lore

[PATCH] git-svn: read the dcommit url from the config file on a per remote basis

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(-)
Show changes to 2 files +15 −1

Documentation/git-svn.txt, git-svn.perl

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· Feb 23, 2009, 22:45 UTC · re: Peter Oberndorfer · lore

Re: [PATCH] git-svn: read the dcommit url from the config file on a per remote basis

Peter Oberndorfer <kumbayo84@arcor.de> wrote:
Show 7 quoted lines
> 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
Show 44 quoted lines
>  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· Feb 23, 2009, 23:06 UTC · re: Eric Wong · lore

Re: [PATCH] git-svn: read the dcommit url from the config file on a per remote basis

Eric Wong <normalperson@yhbt.net> writes:
Show 16 quoted lines
> 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.

← back to recent threads