git-svn: speed up find_rev_before

By limiting start revision of find_rev_before to max existing
revision.  This avoids a long wait if you do
'git svn reset -r 9999999'.  The linear search within the
contiguous revisions doesn't seem to be a problem.

[ew: expanded commit message]

Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
Ben Jackson 2009-06-03 20:45:51 -07:00 коммит произвёл Eric Wong
Родитель 9a8c92ac9e
Коммит ca5e880ec2
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -3171,6 +3171,8 @@ sub find_rev_before {
my ($self, $rev, $eq_ok, $min_rev) = @_;
--$rev unless $eq_ok;
$min_rev ||= 1;
my $max_rev = $self->rev_map_max;
$rev = $max_rev if ($rev > $max_rev);
while ($rev >= $min_rev) {
if (my $c = $self->rev_map_get($rev)) {
return ($rev, $c);