summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ebe8df)
raw | patch | inline | side by side (parent: 3ebe8df)
author | Eric Wong <normalperson@yhbt.net> | |
Fri, 26 Jan 2007 09:32:45 +0000 (01:32 -0800) | ||
committer | Eric Wong <normalperson@yhbt.net> | |
Fri, 23 Feb 2007 08:57:10 +0000 (00:57 -0800) |
I broke this part with the URL minimization; since
git-svn will now try to connect to the root of
the repository and will end up writing files
there if it can...
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn will now try to connect to the root of
the repository and will end up writing files
there if it can...
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl | patch | blob | history | |
t/t9100-git-svn-basic.sh | patch | blob | history | |
t/t9105-git-svn-commit-diff.sh | patch | blob | history |
diff --git a/git-svn.perl b/git-svn.perl
index 4c9ef7fe159716f9f1b0429bc6586a1f2c5663cd..1d448e75dab8e494afb1f5c3eede924bf95e9592 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
my $pool = SVN::Pool->new;
my %ed_opts = ( r => $last_rev,
ra => $ra->dup,
- svn_path => $ra->{svn_path} );
+ svn_path => $gs->{path} );
my $ed = SVN::Git::Editor->new(\%ed_opts,
$ra->get_commit_editor($log,
sub { print "Committed r$_[0]\n";
my $usage = "Usage: $0 commit-diff -r<revision> ".
"<tree-ish> <tree-ish> [<URL>]\n";
fatal($usage) if (!defined $ta || !defined $tb);
+ my $svn_path;
if (!defined $url) {
my $gs = eval { Git::SVN->new };
if (!$gs) {
"the command-line\n", $usage);
}
$url = $gs->{url};
+ $svn_path = $gs->{path};
}
unless (defined $_revision) {
fatal("-r|--revision is a required argument\n", $usage);
$_message ||= get_commit_entry($tb)->{log};
}
my $ra ||= Git::SVN::Ra->new($url);
+ $svn_path ||= $ra->{svn_path};
my $r = $_revision;
if ($r eq 'HEAD') {
$r = $ra->get_latest_revnum;
my $pool = SVN::Pool->new;
my %ed_opts = ( r => $r,
ra => $ra->dup,
- svn_path => $ra->{svn_path} );
+ svn_path => $svn_path );
my $ed = SVN::Git::Editor->new(\%ed_opts,
$ra->get_commit_editor($_message,
sub { print "Committed r$_[0]\n" }),
my $pool = SVN::Pool->new;
my $ed = SVN::Git::Editor->new({ r => $self->{last_rev},
ra => $self->ra->dup,
- svn_path => $self->ra->{svn_path}
+ svn_path => $self->{path}
},
$self->ra->get_commit_editor(
$log_entry->{log}, sub {
$self->{pool} = SVN::Pool->new;
$self->{bat} = { '' => $self->open_root($self->{r}, $self->{pool}) };
$self->{rm} = { };
+ $self->{path_prefix} = length $self->{svn_path} ?
+ "$self->{svn_path}/" : '';
require Digest::MD5;
return $self;
}
}
sub repo_path {
- (defined $_[1] && length $_[1]) ? $_[1] : ''
+ my ($self, $path) = @_;
+ $self->{path_prefix}.(defined $path ? $path : '');
}
sub url_path {
index 5355243b926cf6963db029b020de641e857d7641..3dc4de2fad6a3a1058c721ce5bd799962dd0bf64 100755 (executable)
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
'^:refs/remotes/git-svn$'
"
+test_expect_success 'able to dcommit to a subdirectory' "
+ git-svn fetch -i bar &&
+ git checkout -b my-bar refs/remotes/bar &&
+ echo abc > d &&
+ git update-index --add d &&
+ git commit -m '/bar/d should be in the log' &&
+ git-svn dcommit -i bar &&
+ test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
+ mkdir newdir &&
+ echo new > newdir/dir &&
+ git update-index --add newdir/dir &&
+ git commit -m 'add a new directory' &&
+ git-svn dcommit -i bar &&
+ test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" &&
+ echo foo >> newdir/dir &&
+ git update-index newdir/dir &&
+ git commit -m 'modify a file in new directory' &&
+ git-svn dcommit -i bar &&
+ test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
+ "
+
+test_expect_success 'able to set-tree to a subdirectory' "
+ echo cba > d &&
+ git update-index d &&
+ git commit -m 'update /bar/d' &&
+ git-svn set-tree -i bar HEAD &&
+ test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
+ "
+
test_done
index 6323c7e3ace0dda555ee67b384a197a26bf89dd6..c668dd127082ab400acd505e4970fb6f9cdbad1b 100755 (executable)
cmp readme wc/readme
"
+test_expect_success 'commit-diff to a sub-directory (with git-svn config)' "
+ svn import -m 'sub-directory' import $svnrepo/subdir &&
+ git-svn init $svnrepo/subdir &&
+ git-svn fetch &&
+ git-svn commit-diff -r3 '$prev' '$head' &&
+ svn cat $svnrepo/subdir/readme > readme.2 &&
+ cmp readme readme.2
+ "
+
test_done