* a couple of git-svn patches
@ 2011-04-01 18:42 Alejandro R. Sedeño
2011-04-01 18:42 ` [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config Alejandro R. Sedeño
2011-04-01 18:42 ` [PATCH 2/2] git-svn: Cache results of running the executable "git config" Alejandro R. Sedeño
0 siblings, 2 replies; 8+ messages in thread
From: Alejandro R. Sedeño @ 2011-04-01 18:42 UTC (permalink / raw)
To: git, Eric Wong
Here are two independent git-svn patches that my co-worker handed off
to me back in January.
The first changes the behavior of commit_url to be like that of url so
that you can commit to multiple branches.
The second uses Memoize to cache the results of shelling out to
git-config, which has good performance benefits for git-svn fetch.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config
2011-04-01 18:42 a couple of git-svn patches Alejandro R. Sedeño
@ 2011-04-01 18:42 ` Alejandro R. Sedeño
2011-04-01 18:42 ` [PATCH 2/2] git-svn: Cache results of running the executable "git config" Alejandro R. Sedeño
1 sibling, 0 replies; 8+ messages in thread
From: Alejandro R. Sedeño @ 2011-04-01 18:42 UTC (permalink / raw)
To: git, Eric Wong; +Cc: James Knight, Alejandro R. Sedeño
From: James Knight <jknight@itasoftware.com>
This is necessary if you want to be able to commit to multiple branches.
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
git-svn.perl | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index a5857c1..aa41896 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -523,12 +523,14 @@ sub cmd_dcommit {
}
if (defined $_commit_url) {
- $url = $_commit_url;
+ $url = $_commit_url . (length $gs->{path} ? '/' . $gs->{path} : '');
} else {
$url = eval { command_oneline('config', '--get',
"svn-remote.$gs->{repo_id}.commiturl") };
if (!$url) {
$url = $gs->full_url
+ } else {
+ $url = $url . (length $gs->{path} ? '/' . $gs->{path} : '');
}
}
--
1.7.4.2.1.gd6f1f
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] git-svn: Cache results of running the executable "git config"
2011-04-01 18:42 a couple of git-svn patches Alejandro R. Sedeño
2011-04-01 18:42 ` [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config Alejandro R. Sedeño
@ 2011-04-01 18:42 ` Alejandro R. Sedeño
1 sibling, 0 replies; 8+ messages in thread
From: Alejandro R. Sedeño @ 2011-04-01 18:42 UTC (permalink / raw)
To: git, Eric Wong; +Cc: James Y Knight, Alejandro R. Sedeño
From: James Y Knight <jknight@itasoftware.com>
Running programs is not cheap!
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
git-svn.perl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index aa41896..e47e04c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -59,6 +59,7 @@ use File::Find;
use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
use IPC::Open3;
use Git;
+use Memoize; # core since 5.8.0, Jul 2002
BEGIN {
# import functions from Git into our packages, en masse
@@ -72,6 +73,8 @@ BEGIN {
*{"${package}::$_"} = \&{"Git::$_"};
}
}
+ Memoize::memoize 'Git::config';
+ Memoize::memoize 'Git::config_bool';
}
my ($SVN);
@@ -3199,6 +3202,8 @@ sub has_no_changes {
Memoize::unmemoize 'check_cherry_pick';
Memoize::unmemoize 'has_no_changes';
}
+
+ Memoize::memoize 'Git::SVN::repos_root';
}
END {
--
1.7.4.2.1.gd6f1f
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config
2011-04-04 19:09 [PATCHv2 0/2] a couple of git-svn patches Alejandro R. Sedeño
@ 2011-04-04 19:09 ` Alejandro R. Sedeño
2011-04-04 21:52 ` Eric Wong
0 siblings, 1 reply; 8+ messages in thread
From: Alejandro R. Sedeño @ 2011-04-04 19:09 UTC (permalink / raw)
To: git, Eric Wong; +Cc: James Y Knight, Alejandro R. Sedeño
From: James Y Knight <jknight@itasoftware.com>
This is necessary if you want to be able to commit to multiple branches.
Signed-off-by: James Y Knight <jknight@itasoftware.com>
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
---
git-svn.perl | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index a5857c1..aa41896 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -523,12 +523,14 @@ sub cmd_dcommit {
}
if (defined $_commit_url) {
- $url = $_commit_url;
+ $url = $_commit_url . (length $gs->{path} ? '/' . $gs->{path} : '');
} else {
$url = eval { command_oneline('config', '--get',
"svn-remote.$gs->{repo_id}.commiturl") };
if (!$url) {
$url = $gs->full_url
+ } else {
+ $url = $url . (length $gs->{path} ? '/' . $gs->{path} : '');
}
}
--
1.7.4.2.1.gd6f1f
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config
2011-04-04 19:09 ` [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config Alejandro R. Sedeño
@ 2011-04-04 21:52 ` Eric Wong
2011-04-04 22:16 ` James Y Knight
0 siblings, 1 reply; 8+ messages in thread
From: Eric Wong @ 2011-04-04 21:52 UTC (permalink / raw)
To: Alejandro R. Sedeño, James Y Knight; +Cc: git
"Alejandro R. Sedeño" <asedeno@mit.edu> wrote:
> From: James Y Knight <jknight@itasoftware.com>
>
> This is necessary if you want to be able to commit to multiple branches.
I'm not sure I understand the need for this patch, see below.
> @@ -523,12 +523,14 @@ sub cmd_dcommit {
> }
>
> if (defined $_commit_url) {
> - $url = $_commit_url;
> + $url = $_commit_url . (length $gs->{path} ? '/' . $gs->{path} : '');
$_commit_url is a user-specified parameter from the --commit-url switch.
If they want to override it it's the user's perogative. It's not the
default and not commonly used.
> } else {
> $url = eval { command_oneline('config', '--get',
> "svn-remote.$gs->{repo_id}.commiturl") };
> if (!$url) {
> $url = $gs->full_url
If unspecified, we always fall back to the gs->full_url case anyways
which just duplicates the logic you've added. Again, commitUrl usually
does not need to be specified since it is autodetected.
> + } else {
> + $url = $url . (length $gs->{path} ? '/' . $gs->{path} : '');
> }
> }
--
Eric Wong
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config
2011-04-04 21:52 ` Eric Wong
@ 2011-04-04 22:16 ` James Y Knight
2011-04-04 22:54 ` Eric Wong
0 siblings, 1 reply; 8+ messages in thread
From: James Y Knight @ 2011-04-04 22:16 UTC (permalink / raw)
To: Eric Wong; +Cc: Alejandro R. Sedeño, git
On Apr 4, 2011, at 5:52 PM, Eric Wong wrote:
> $_commit_url is a user-specified parameter from the --commit-url switch.
> If they want to override it it's the user's perogative. It's not the
> default and not commonly used.
In .git/config:
[svn-remote "svn"]
url = http://hostname/svnrepo/
commiturl = svn+ssh://hostname/svnrepo
branches = branches/*:refs/remotes/origin/*
fetch = trunk:refs/remotes/origin/master
The commiturl configuration is necessary so that the canonical URL is the http:// url (which can be used for read-only access), but if you want to commit, you have to use svn+ssh. This is a fairly common way of setting up access to an svn repository, so I'm surprised to be the first one to hit this issue.
Without the patch, you need:
commiturl = svn+ssh://hostname/svnrepo/trunk
which of course then doesn't allow you to commit to other branches.
James
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config
2011-04-04 22:16 ` James Y Knight
@ 2011-04-04 22:54 ` Eric Wong
2011-04-05 15:11 ` "Alejandro R. Sedeño"
0 siblings, 1 reply; 8+ messages in thread
From: Eric Wong @ 2011-04-04 22:54 UTC (permalink / raw)
To: James Y Knight; +Cc: Alejandro R. Sedeño, git
James Y Knight <jknight@itasoftware.com> wrote:
> On Apr 4, 2011, at 5:52 PM, Eric Wong wrote:
> > $_commit_url is a user-specified parameter from the --commit-url switch.
> > If they want to override it it's the user's perogative. It's not the
> > default and not commonly used.
>
> In .git/config:
>
> [svn-remote "svn"]
> url = http://hostname/svnrepo/
> commiturl = svn+ssh://hostname/svnrepo
> branches = branches/*:refs/remotes/origin/*
> fetch = trunk:refs/remotes/origin/master
>
> The commiturl configuration is necessary so that the canonical URL is the http:// url (which can be used for read-only access), but if you want to commit, you have to use svn+ssh. This is a fairly common way of setting up access to an svn repository, so I'm surprised to be the first one to hit this issue.
>
> Without the patch, you need:
> commiturl = svn+ssh://hostname/svnrepo/trunk
> which of course then doesn't allow you to commit to other branches.
Originally --commit-url was only intended to be a command-line option
and for overriding specific cases and also for dealing with permission
mismatches (limited commit access to a branch, unlimited read access
to the repo).
Your patch breaks existing use cases, I think.
I think Junio's suggestion for a pushurl config which does what you
think commitUrl does would be what you're after...
Thanks
--
Eric Wong
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config
2011-04-04 22:54 ` Eric Wong
@ 2011-04-05 15:11 ` "Alejandro R. Sedeño"
0 siblings, 0 replies; 8+ messages in thread
From: "Alejandro R. Sedeño" @ 2011-04-05 15:11 UTC (permalink / raw)
To: Eric Wong; +Cc: James Y Knight, git
On 04/04/2011 06:54 PM, Eric Wong wrote:
> James Y Knight <jknight@itasoftware.com> wrote:
>> > On Apr 4, 2011, at 5:52 PM, Eric Wong wrote:
>>> > > $_commit_url is a user-specified parameter from the --commit-url switch.
>>> > > If they want to override it it's the user's perogative. It's not the
>>> > > default and not commonly used.
>> >
>> > In .git/config:
>> >
>> > [svn-remote "svn"]
>> > url = http://hostname/svnrepo/
>> > commiturl = svn+ssh://hostname/svnrepo
>> > branches = branches/*:refs/remotes/origin/*
>> > fetch = trunk:refs/remotes/origin/master
>> >
>> > The commiturl configuration is necessary so that the canonical URL is the http:// url (which can be used for read-only access), but if you want to commit, you have to use svn+ssh. This is a fairly common way of setting up access to an svn repository, so I'm surprised to be the first one to hit this issue.
>> >
>> > Without the patch, you need:
>> > commiturl = svn+ssh://hostname/svnrepo/trunk
>> > which of course then doesn't allow you to commit to other branches.
> Originally --commit-url was only intended to be a command-line option
> and for overriding specific cases and also for dealing with permission
> mismatches (limited commit access to a branch, unlimited read access
> to the repo).
>
> Your patch breaks existing use cases, I think.
>
> I think Junio's suggestion for a pushurl config which does what you
> think commitUrl does would be what you're after...
That sounds good to me. I'll submit an updated patch later today.
-Alejandro
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-04-05 15:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01 18:42 a couple of git-svn patches Alejandro R. Sedeño
2011-04-01 18:42 ` [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config Alejandro R. Sedeño
2011-04-01 18:42 ` [PATCH 2/2] git-svn: Cache results of running the executable "git config" Alejandro R. Sedeño
-- strict thread matches above, loose matches on Subject: below --
2011-04-04 19:09 [PATCHv2 0/2] a couple of git-svn patches Alejandro R. Sedeño
2011-04-04 19:09 ` [PATCH 1/2] git-svn: Fix the commit-url config to be the base url, just like the url config Alejandro R. Sedeño
2011-04-04 21:52 ` Eric Wong
2011-04-04 22:16 ` James Y Knight
2011-04-04 22:54 ` Eric Wong
2011-04-05 15:11 ` "Alejandro R. Sedeño"
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).