Skip to content

Commit

Permalink
git-svn: add ability to specify --commit-url for dcommit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Aug 8, 2008
1 parent b3bc97c commit ba24e74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Documentation/git-svn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ and have no uncommitted changes.
+
--no-rebase;;
After committing, do not rebase or reset.
--commit-url <URL>;;
Commit to this SVN URL (the full path). This is intended to
allow existing git-svn repositories created with one transport
method (e.g. `svn://` or `http://` for anonymous read) to be
reused if a user is later given access to an alternate transport
method (e.g. `svn+ssh://` or `https://`) for commit.

Using this option for any other purpose (don't ask)
is very strongly discouraged.
--

'log'::
Expand Down
9 changes: 6 additions & 3 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BEGIN
$_version, $_fetch_all, $_no_rebase,
$_merge, $_strategy, $_dry_run, $_local,
$_prefix, $_no_checkout, $_url, $_verbose,
$_git_format);
$_git_format, $_commit_url);
$Git::SVN::_follow_parent = 1;
my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
'config-dir=s' => \$Git::SVN::Ra::config_dir,
Expand Down Expand Up @@ -127,6 +127,8 @@ BEGIN
'verbose|v' => \$_verbose,
'dry-run|n' => \$_dry_run,
'fetch-all|all' => \$_fetch_all,
'commit-url=s' => \$_commit_url,
'revision|r=i' => \$_revision,
'no-rebase' => \$_no_rebase,
%cmt_opts, %fc_opts } ],
'set-tree' => [ \&cmd_set_tree,
Expand Down Expand Up @@ -416,14 +418,15 @@ sub cmd_dcommit {
$head ||= 'HEAD';
my @refs;
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
$url = $_commit_url if defined $_commit_url;
my $last_rev = $_revision if defined $_revision;
if ($url) {
print "Committing to $url ...\n";
}
unless ($gs) {
die "Unable to determine upstream SVN information from ",
"$head history.\nPerhaps the repository is empty.";
}
my $last_rev;
my ($linear_refs, $parents) = linearize_history($gs, \@refs);
if ($_no_rebase && scalar(@$linear_refs) > 1) {
warn "Attempting to commit more than one change while ",
Expand All @@ -446,7 +449,7 @@ sub cmd_dcommit {
my $cmt_rev;
my %ed_opts = ( r => $last_rev,
log => get_commit_entry($d)->{log},
ra => Git::SVN::Ra->new($gs->full_url),
ra => Git::SVN::Ra->new($url),
config => SVN::Core::config_get_config(
$Git::SVN::Ra::config_dir
),
Expand Down

0 comments on commit ba24e74

Please sign in to comment.