Skip to contentSkip to conversation

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

PATCH In review Peter Oberndorfer 4 participants 10 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-svn: try to read the dcommit url from the config file

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

---

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://[email protected]/home/kde/trunk/KDE/kdelibs

 Documentation/git-svn.txt |    2 ++
 git-svn.perl              |   12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)
Documentation/git-svn.txt +2 -0
index 3d45654..0d11428 100644
@@ -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.
 --
git-svn.perl +11 -1
index 83cb36f..2ad3603 100755
@@ -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";
Signature · 1 line
1.6.1.3
#1 lore raw

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://[email protected]/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

#2 lore raw

Re: git svn dcommit difficulties/feature request

Quoted 19 lines · Peter Oberndorfer

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://[email protected]/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.

Quoted 8 lines

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

Signature · 1 line
Eric Wong
#3 lore raw

Re: git svn dcommit difficulties/feature request

In reply to Peter Oberndorfer

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.

Signature · 1 line
Kevin
Quoted 34 lines · Peter Oberndorfer

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://[email protected]/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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Peter Oberndorfer
Quoted 2 lines · Peter Oberndorfer

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

Quoted 1 line

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

Quoted 64 lines

svn-remote.<name>.url

---

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://[email protected]/home/kde/trunk/KDE/kdelibs

 Documentation/git-svn.txt |    2 ++
 git-svn.perl              |   12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)
Documentation/git-svn.txt +2 -0
index 3d45654..0d11428 100644
@@ -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.
 --
git-svn.perl +11 -1
index 83cb36f..2ad3603 100755
@@ -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";
Signature · 1 line
1.6.1.3
#5 lore raw
Quoted 8 lines · Eric Wong
Quoted 2 lines · Peter Oberndorfer

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.

Quoted 8 lines
Quoted 1 line

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

Quoted 2 lines

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

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

Quoted 5 lines
Quoted 5 lines

svn-remote.<name>.url

---

Greetings Peter

#6 lore raw
Quoted 7 lines · Peter Oberndorfer
Quoted 6 lines · Eric Wong
Quoted 2 lines · Peter Oberndorfer

The commit url is determined in the following order --commit-url commandline

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

Quoted 7 lines
Quoted 2 lines

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

Quoted 10 lines
Quoted 8 lines
Quoted 1 line

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

Quoted 4 lines
Quoted 2 lines

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

Signature · 1 line
Eric Wong
#7 lore raw

PATCH 1/1 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

---
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(-)
Documentation/git-svn.txt +4 -0
index 3d45654..cda3389 100644
@@ -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.
 --
git-svn.perl +11 -1
index cbc5211..be4d011 100755
@@ -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";
Signature · 1 line
1.6.1.3
#8 lore raw

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

Quoted 11 lines · Peter Oberndorfer

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

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

Quoted 44 lines
 Documentation/git-svn.txt |    4 ++++
 git-svn.perl              |   12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
Documentation/git-svn.txt +4 -0
index 3d45654..cda3389 100644
@@ -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.
 --
git-svn.perl +11 -1
index cbc5211..be4d011 100755
@@ -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";
Signature · 1 line
1.6.1.3
#9 lore raw

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

Quoted 9 lines · Eric Wong
Quoted 7 lines · Peter Oberndorfer

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

Quoted 7 lines
Quoted 3 lines

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