don't stop on svn branch points when getting the
authorStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 02:15:27 +0000 (03:15 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 02:15:27 +0000 (03:15 +0100)
missing revisions, also return the branch path
together with each revision number

metze

SVN2GitPatch.pm
sync-v4-0-test.pl

index f2db22a14a9d01fb1a9db8212f04af89e383b773..3f65cbc947fe0af8810f3a88e24a997888fd93c4 100644 (file)
@@ -63,21 +63,24 @@ sub get_missing_svn_revs($$$)
 {
        my ($self, $branch, $start_rev) = @_;
        my $last_rev = $self->get_last_svn_rev($branch);
-       my @ret = ();
+       my $r = undef;
 
        my $nroot = $self->{repos}->fs->revision_root($last_rev);
        my $hist = $nroot->node_history($branch);
 
-       while ($hist = $hist->prev(0)) {
-               my $crev = $hist->location();
+       while ($hist) {
+               my ($cpath, $crev) = $hist->location();
                last unless defined($crev);
                last unless $crev > 0;
                last unless $crev > $start_rev;
 
-               unshift(@ret, $crev);
+               $r->{$crev}->{rev} = $crev;
+               $r->{$crev}->{branch} = $cpath;
+
+               $hist = $hist->prev(1);
        }
 
-       return @ret;
+       return $r;
 }
 
 sub svn2git_author($$)
index 5824628abae90c4dc5f1348d6df2be111e453171..d1658438c4487d26e4a6c6f6da1caa98705d5dfc 100755 (executable)
@@ -45,14 +45,13 @@ sub set_last_svn_rev($$)
 
 my $last_rev = $r->get_last_svn_rev($svn_branch);
 my $start_rev = get_last_svn_rev($last_svn_rev_file, $svn_start_rev);
-my @revs = $r->get_missing_svn_revs($svn_branch, $start_rev);
+my $revs = $r->get_missing_svn_revs($svn_branch, $start_rev);
 
 print "start: $start_rev last: $last_rev\n";
 
-foreach my $rev (@revs) {
-
+foreach my $rev (sort keys %{$revs}) {
        print "Get patch for rev: $rev\n";
-       my $p = $r->get_git_patch($svn_branch, $rev);
+       my $p = $r->get_git_patch($revs->{$rev}->{branch}, $rev);
 
        next unless defined($p->{git_patch});