diff options
Diffstat (limited to 'perl/Git')
-rw-r--r-- | perl/Git/SVN.pm | 47 | ||||
-rw-r--r-- | perl/Git/SVN/Log.pm | 1 | ||||
-rw-r--r-- | perl/Git/SVN/Migration.pm | 2 |
3 files changed, 43 insertions, 7 deletions
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm index 5273ee8867..a59564fb34 100644 --- a/perl/Git/SVN.pm +++ b/perl/Git/SVN.pm @@ -480,8 +480,8 @@ sub refname { # It cannot end with a slash /, we'll throw up on this because # SVN can't have directories with a slash in their name, either: if ($refname =~ m{/$}) { - die "ref: '$refname' ends with a trailing slash, this is ", - "not permitted by git nor Subversion\n"; + die "ref: '$refname' ends with a trailing slash; this is ", + "not permitted by git or Subversion\n"; } # It cannot have ASCII control character space, tilde ~, caret ^, @@ -1191,7 +1191,7 @@ sub do_fetch { # we can have a branch that was deleted, then re-added # under the same name but copied from another path, in # which case we'll have multiple parents (we don't - # want to break the original ref, nor lose copypath info): + # want to break the original ref or lose copypath info): if (my $log_entry = $self->find_parent_branch($paths, $rev)) { push @{$log_entry->{parents}}, $lc; return $log_entry; @@ -1599,6 +1599,7 @@ sub tie_for_persistent_memoization { my %lookup_svn_merge_cache; my %check_cherry_pick_cache; my %has_no_changes_cache; + my %_rev_list_cache; tie_for_persistent_memoization(\%lookup_svn_merge_cache, "$cache_path/lookup_svn_merge"); @@ -1620,6 +1621,14 @@ sub tie_for_persistent_memoization { SCALAR_CACHE => ['HASH' => \%has_no_changes_cache], LIST_CACHE => 'FAULT', ; + + tie_for_persistent_memoization(\%_rev_list_cache, + "$cache_path/_rev_list"); + memoize '_rev_list', + SCALAR_CACHE => 'FAULT', + LIST_CACHE => ['HASH' => \%_rev_list_cache], + ; + } sub unmemoize_svn_mergeinfo_functions { @@ -1629,6 +1638,7 @@ sub tie_for_persistent_memoization { Memoize::unmemoize 'lookup_svn_merge'; Memoize::unmemoize 'check_cherry_pick'; Memoize::unmemoize 'has_no_changes'; + Memoize::unmemoize '_rev_list'; } sub clear_memoized_mergeinfo_caches { @@ -1959,11 +1969,25 @@ sub rebuild_from_rev_db { unlink $path or croak "unlink: $!"; } +#define a global associate map to record rebuild status +my %rebuild_status; +#define a global associate map to record rebuild verify status +my %rebuild_verify_status; + sub rebuild { my ($self) = @_; my $map_path = $self->map_path; my $partial = (-e $map_path && ! -z $map_path); - return unless ::verify_ref($self->refname.'^0'); + my $verify_key = $self->refname.'^0'; + if (!$rebuild_verify_status{$verify_key}) { + my $verify_result = ::verify_ref($verify_key); + if ($verify_result) { + $rebuild_verify_status{$verify_key} = 1; + } + } + if (!$rebuild_verify_status{$verify_key}) { + return; + } if (!$partial && ($self->use_svm_props || $self->no_metadata)) { my $rev_db = $self->rev_db_path; $self->rebuild_from_rev_db($rev_db); @@ -1977,10 +2001,21 @@ sub rebuild { print "Rebuilding $map_path ...\n" if (!$partial); my ($base_rev, $head) = ($partial ? $self->rev_map_max_norebuild(1) : (undef, undef)); + my $key_value = ($head ? "$head.." : "") . $self->refname; + if (exists $rebuild_status{$key_value}) { + print "Done rebuilding $map_path\n" if (!$partial || !$head); + my $rev_db_path = $self->rev_db_path; + if (-f $self->rev_db_path) { + unlink $self->rev_db_path or croak "unlink: $!"; + } + $self->unlink_rev_db_symlink; + return; + } my ($log, $ctx) = - command_output_pipe(qw/rev-list --pretty=raw --reverse/, - ($head ? "$head.." : "") . $self->refname, + command_output_pipe(qw/rev-list --pretty=raw --reverse/, + $key_value, '--'); + $rebuild_status{$key_value} = 1; my $metadata_url = $self->metadata_url; remove_username($metadata_url); my $svn_uuid = $self->rewrite_uuid || $self->ra_uuid; diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm index 3f8350a57d..34f2869ab5 100644 --- a/perl/Git/SVN/Log.pm +++ b/perl/Git/SVN/Log.pm @@ -117,6 +117,7 @@ sub run_pager { } open STDIN, '<&', $rfd or fatal "Can't redirect stdin: $!"; $ENV{LESS} ||= 'FRSX'; + $ENV{LV} ||= '-c'; exec $pager or fatal "Can't run pager: $! ($pager)"; } diff --git a/perl/Git/SVN/Migration.pm b/perl/Git/SVN/Migration.pm index 30daf35465..cf6ffa7581 100644 --- a/perl/Git/SVN/Migration.pm +++ b/perl/Git/SVN/Migration.pm @@ -1,6 +1,6 @@ package Git::SVN::Migration; # these version numbers do NOT correspond to actual version numbers -# of git nor git-svn. They are just relative. +# of git or git-svn. They are just relative. # # v0 layout: .git/$id/info/url, refs/heads/$id-HEAD # |