diff options
author | Sam Vilain <sam@vilain.net> | 2007-06-30 20:56:14 +1200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-30 23:36:32 -0700 |
commit | 40cb8f8f08d409b3a2d39aae8c6b99bccd945436 (patch) | |
tree | 3e694173247be3199098a7e08cf19eac43586f12 /git-svn.perl | |
parent | 3dfab993c8c9a30450635e4d660f26bb508ae3af (diff) | |
download | git-40cb8f8f08d409b3a2d39aae8c6b99bccd945436.tar.gz |
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>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-x | git-svn.perl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl index d111dc1442..d5088eab9c 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -806,6 +806,7 @@ sub working_head_info { my ($head, $refs) = @_; my ($fh, $ctx) = command_output_pipe('log', $head); my $hash; + my %max; while (<$fh>) { if ( m{^commit ($::sha1)$} ) { unshift @$refs, $hash if $hash and $refs; @@ -815,11 +816,14 @@ sub working_head_info { next unless s{^\s*(git-svn-id:)}{$1}; my ($url, $rev, $uuid) = extract_metadata($_); if (defined $url && defined $rev) { + next if $max{$url} and $max{$url} < $rev; if (my $gs = Git::SVN->find_by_url($url)) { my $c = $gs->rev_db_get($rev); if ($c && $c eq $hash) { close $fh; # break the pipe return ($url, $rev, $uuid, $gs); + } else { + $max{$url} ||= $gs->rev_db_max; } } } |