summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e6434f8)
raw | patch | inline | side by side (parent: e6434f8)
author | Eric Wong <normalperson@yhbt.net> | |
Wed, 24 Jan 2007 10:16:25 +0000 (02:16 -0800) | ||
committer | Eric Wong <normalperson@yhbt.net> | |
Fri, 23 Feb 2007 08:57:10 +0000 (00:57 -0800) |
This means that tracking the path of:
/another-larger/trunk/thunk/bump/thud inside a repository
would follow:
/larger-parent/trunk/thunk/bump/thud
even if the svn log output looks like this:
--------------------------------------------
Changed paths:
A /another-larger (from /larger-parent:5)
--------------------------------------------
Note: the usage of get_log() in git-svn still makes a
an assumption that shouldn't be made with regard to
revisions existing for a particular path.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
/another-larger/trunk/thunk/bump/thud inside a repository
would follow:
/larger-parent/trunk/thunk/bump/thud
even if the svn log output looks like this:
--------------------------------------------
Changed paths:
A /another-larger (from /larger-parent:5)
--------------------------------------------
Note: the usage of get_log() in git-svn still makes a
an assumption that shouldn't be made with regard to
revisions existing for a particular path.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl | patch | blob | history | |
t/t9104-git-svn-follow-parent.sh | patch | blob | history |
diff --git a/git-svn.perl b/git-svn.perl
index d290a0d8eeb37cc5676dab975876713ab7e2e8f9..123d4d63f425739b59e18f66577e529419cb94ed 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
return undef unless $::_follow_parent;
# look for a parent from another branch:
- my $abs_path = '/'.$self->rel_path;
- my $i = $paths->{$abs_path} or goto not_found;
+ my @b_path_components = split m#/#, $self->rel_path;
+ my @a_path_components;
+ my $i;
+ while (@b_path_components) {
+ $i = $paths->{'/'.join('/', @b_path_components)};
+ last if $i;
+ unshift(@a_path_components, pop(@b_path_components));
+ }
+ goto not_found unless defined $i;
my $branch_from = $i->copyfrom_path or goto not_found;
+ if (@a_path_components) {
+ print STDERR "branch_from: $branch_from => ";
+ $branch_from .= '/'.join('/', @a_path_components);
+ print STDERR $branch_from, "\n";
+ }
my $r = $i->copyfrom_rev;
my $repos_root = $self->ra->{repos_root};
my $url = $self->ra->{url};
}
my ($r0, $parent) = $gs->find_rev_before($r, 1);
if ($::_follow_parent && (!defined $r0 || !defined $parent)) {
- foreach (0 .. $r) {
- my $log_entry = eval { $gs->do_fetch(undef, $_) };
+ $gs->ra->get_log([$gs->{path}], 0, $r, 0, 1, 1, sub {
+ my ($paths, $rev) = @_;
+ my $log_entry = eval { $gs->do_fetch($paths, $rev) };
$gs->do_git_commit($log_entry) if $log_entry;
- }
+ });
($r0, $parent) = $gs->last_rev_commit;
}
if (defined $r0 && defined $parent && $gs->revisions_eq($r0, $r)) {
return $self->make_log_entry($rev, [$parent], $ed);
}
not_found:
- print STDERR "Branch parent for path: '$abs_path' not found\n";
+ print STDERR "Branch parent for path: '/",
+ $self->rel_path, "' not found\n";
return undef unless $paths;
- foreach my $p (sort keys %$paths) {
- print STDERR ' ', $p->action, ' ', $p;
+ foreach my $x (sort keys %$paths) {
+ my $p = $paths->{$x};
+ print STDERR ' ', $p->action, ' ', $x;
if (my $cp_from = $p->copyfrom_path) {
print STDERR "(from $cp_from:", $p->copyfrom_rev, ')';
}
index 402b614c76ffc53c4e2904b85fee94719519e7d1..22b45a660297dc70eeda931fa92acbf997c405aa 100755 (executable)
= \"\`git rev-parse svn/trunk\`\"
"
+test_expect_success 'follow larger parent' "
+ mkdir -p import/trunk/thunk/bump/thud &&
+ echo hi > import/trunk/thunk/bump/thud/file &&
+ svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
+ svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
+ git-svn init -i larger $svnrepo/another-larger/trunk/thunk/bump/thud &&
+ git-svn fetch -i larger --follow-parent &&
+ git-rev-parse --verify refs/remotes/larger &&
+ git-rev-parse --verify \
+ refs/remotes/larger-parent/trunk/thunk/bump/thud &&
+ test \"\`git-merge-base \
+ refs/remotes/larger-parent/trunk/thunk/bump/thud \
+ refs/remotes/larger\`\" = \
+ \"\`git-rev-parse refs/remotes/larger\`\"
+ true
+ "
+
test_debug 'gitk --all &'
test_done