Skip to content

Commit ba24e74

Browse files
Eric Wonggitster
authored andcommitted
git-svn: add ability to specify --commit-url for dcommit
This allows one to use public svn:// URLs for fetch and svn+ssh:// URLs for committing (without using the complicated rewriteRoot option, reimporting or git-filter-branch). Using this can also help avoid unnecessary server authentication/encryption overhead on busy SVN servers. Along with the new --revision option, this can also be allowed to override the branch detection in dcommit, too. This is potentially dangerous and not recommended! (And also purposely undocumented, but the loaded gun is there in case somebody wants to make it safe). Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b3bc97c commit ba24e74

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Documentation/git-svn.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ and have no uncommitted changes.
138138
+
139139
--no-rebase;;
140140
After committing, do not rebase or reset.
141+
--commit-url <URL>;;
142+
Commit to this SVN URL (the full path). This is intended to
143+
allow existing git-svn repositories created with one transport
144+
method (e.g. `svn://` or `http://` for anonymous read) to be
145+
reused if a user is later given access to an alternate transport
146+
method (e.g. `svn+ssh://` or `https://`) for commit.
147+
148+
Using this option for any other purpose (don't ask)
149+
is very strongly discouraged.
141150
--
142151

143152
'log'::

git-svn.perl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ BEGIN
6666
$_version, $_fetch_all, $_no_rebase,
6767
$_merge, $_strategy, $_dry_run, $_local,
6868
$_prefix, $_no_checkout, $_url, $_verbose,
69-
$_git_format);
69+
$_git_format, $_commit_url);
7070
$Git::SVN::_follow_parent = 1;
7171
my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
7272
'config-dir=s' => \$Git::SVN::Ra::config_dir,
@@ -127,6 +127,8 @@ BEGIN
127127
'verbose|v' => \$_verbose,
128128
'dry-run|n' => \$_dry_run,
129129
'fetch-all|all' => \$_fetch_all,
130+
'commit-url=s' => \$_commit_url,
131+
'revision|r=i' => \$_revision,
130132
'no-rebase' => \$_no_rebase,
131133
%cmt_opts, %fc_opts } ],
132134
'set-tree' => [ \&cmd_set_tree,
@@ -416,14 +418,15 @@ sub cmd_dcommit {
416418
$head ||= 'HEAD';
417419
my @refs;
418420
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
421+
$url = $_commit_url if defined $_commit_url;
422+
my $last_rev = $_revision if defined $_revision;
419423
if ($url) {
420424
print "Committing to $url ...\n";
421425
}
422426
unless ($gs) {
423427
die "Unable to determine upstream SVN information from ",
424428
"$head history.\nPerhaps the repository is empty.";
425429
}
426-
my $last_rev;
427430
my ($linear_refs, $parents) = linearize_history($gs, \@refs);
428431
if ($_no_rebase && scalar(@$linear_refs) > 1) {
429432
warn "Attempting to commit more than one change while ",
@@ -446,7 +449,7 @@ sub cmd_dcommit {
446449
my $cmt_rev;
447450
my %ed_opts = ( r => $last_rev,
448451
log => get_commit_entry($d)->{log},
449-
ra => Git::SVN::Ra->new($gs->full_url),
452+
ra => Git::SVN::Ra->new($url),
450453
config => SVN::Core::config_get_config(
451454
$Git::SVN::Ra::config_dir
452455
),

0 commit comments

Comments
 (0)