old and new branch need to be 2 things
authorStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 02:11:55 +0000 (03:11 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 02:11:55 +0000 (03:11 +0100)
that's how svn branching and tagging works

metze

SVN2GitEditor.pm
SVN2GitPatch.pm

index c3416c4..8488080 100644 (file)
@@ -252,7 +252,7 @@ sub close_directory {
 sub delete_entry {
     my ($self, $path, $revision, $pdir, $pool) = @_;
 
-    my $fullpath = "$self->{branch}/$path";
+    my $fullpath = "$self->{oldbranch}/$path";
 
     if ($self->{oldroot}->is_file($fullpath)) {
        $self->{info}{$path}{from_path} = $path;
index d3f668a..f2db22a 100644 (file)
@@ -135,6 +135,10 @@ sub get_git_patch($$$)
        my $oroot = $self->{repos}->fs->revision_root($orev);
        my $nroot = $self->{repos}->fs->revision_root($nrev);
 
+       my $nbranch = $branch;
+       my $obranch = $nroot->copied_from($nbranch);
+       $obranch = $nbranch unless defined($obranch);
+
        my $p = undef;
 
        $p->{svn_author} = $self->{repos}->fs->revision_prop($nrev, "svn:author");
@@ -146,28 +150,30 @@ sub get_git_patch($$$)
        my $editor = SVN2GitEditor->new(
                cb_basecontent => sub {
                        my ($path, $pool) = @_;
-                       my $base = $oroot->file_contents("$branch/$path", $pool);
+                       my $base = $oroot->file_contents("$obranch/$path", $pool);
                        return $base;
                },
                cb_baseprop => sub {
                        my ($path, $pname, $pool) = @_;
-                       my $prop = $oroot->node_prop("$branch/$path", $pname, $pool);
+                       my $prop = $oroot->node_prop("$obranch/$path", $pname, $pool);
                        return $prop;
                },
-               oldrepos => $self->{repos},
+               repos => $self->{repos},
                oldroot => $oroot,
                oldrev => $orev,
+               oldbranch => $obranch,
+               newroot => $nroot,
                newrev => $nrev,
-               branch => $branch,
+               newbranch => $nbranch,
                llabel => "revision $orev",
                rlabel => "revision $nrev",
                external => undef,
                output => \$p->{git_diff});
 
        SVN::Repos::dir_delta($oroot,
-                             $branch, '',
+                             $obranch, '',
                              $nroot,
-                             $branch,
+                             $nbranch,
                              $editor,
                              undef, 1, 1, 1, 1);