@matheusbsbs / matheus-bagliano / commits / 40cb8f8f08
Fork 0

git-svn: cache max revision in rev_db databases

Cache the maximum revision for each rev_db URL rather than looking it up each time. This saves a lot of time when rebuilding indexes on a freshly cloned repository. Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sam Vilain committed Jun 30, 2007 at 20:56 UTC 40cb8f8f08d409b3a2d39aae8c6b99bccd945436
1 file changed +4
git-svn.perl
+4
@@ -806,6 +806,7 @@ sub working_head_info {
806 my ($head, $refs) = @_;
807 my ($fh, $ctx) = command_output_pipe('log', $head);
808 my $hash;
809 + my %max;
810 while (<$fh>) {
811 if ( m{^commit ($::sha1)$} ) {
812 unshift @$refs, $hash if $hash and $refs;
@@ -815,11 +816,14 @@ sub working_head_info {
816 next unless s{^\s*(git-svn-id:)}{$1};
817 my ($url, $rev, $uuid) = extract_metadata($_);
818 if (defined $url && defined $rev) {
819 + next if $max{$url} and $max{$url} < $rev;
820 if (my $gs = Git::SVN->find_by_url($url)) {
821 my $c = $gs->rev_db_get($rev);
822 if ($c && $c eq $hash) {
823 close $fh; # break the pipe
824 return ($url, $rev, $uuid, $gs);
825 + } else {
826 + $max{$url} ||= $gs->rev_db_max;
827 }
828 }
829 }