summaryrefslogtreecommitdiff
path: root/perl/Git/SVN.pm
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2014-10-20 01:02:53 (GMT)
committerEric Wong <normalperson@yhbt.net>2014-10-24 22:55:39 (GMT)
commit54b95346c1322bb122e12aba0f03652f241a918b (patch)
treec46abef2bf90b17a0488628ff7f85991011b8cce /perl/Git/SVN.pm
parentd0b34f241dc59fe2352cb1a724d0c5e8f0d2ff82 (diff)
downloadgit-54b95346c1322bb122e12aba0f03652f241a918b.zip
git-54b95346c1322bb122e12aba0f03652f241a918b.tar.gz
git-54b95346c1322bb122e12aba0f03652f241a918b.tar.bz2
git-svn: cache only mergeinfo revisions
This should reduce excessive memory usage from the new mergeinfo caches without hurting performance too much, assuming reasonable latency to the SVN server. Cc: Hin-Tak Leung <htl10@users.sourceforge.net> Suggested-by: Jakob Stoklund Olesen <stoklund@2pi.dk> Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'perl/Git/SVN.pm')
-rw-r--r--perl/Git/SVN.pm22
1 files changed, 8 insertions, 14 deletions
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 171af37..f8a75b1 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -1713,13 +1713,10 @@ sub mergeinfo_changes {
# Initialize cache on the first call.
unless (defined $self->{cached_mergeinfo_rev}) {
$self->{cached_mergeinfo_rev} = {};
- $self->{cached_mergeinfo} = {};
}
my $cached_rev = $self->{cached_mergeinfo_rev}{$old_path};
- if (defined $cached_rev && $cached_rev == $old_rev) {
- $old_minfo = $self->{cached_mergeinfo}{$old_path};
- } else {
+ unless (defined $cached_rev && $cached_rev == $old_rev) {
my $ra = $self->ra;
# Give up if $old_path isn't in the repo.
# This is probably a merge on a subtree.
@@ -1728,19 +1725,16 @@ sub mergeinfo_changes {
"directory didn't exist in r$old_rev\n";
return {};
}
- my (undef, undef, $props) =
- $self->ra->get_dir($old_path, $old_rev);
- if (defined $props->{"svn:mergeinfo"}) {
- my %omi = map {split ":", $_ } split "\n",
- $props->{"svn:mergeinfo"};
- $old_minfo = \%omi;
- }
- $self->{cached_mergeinfo}{$old_path} = $old_minfo;
- $self->{cached_mergeinfo_rev}{$old_path} = $old_rev;
}
+ my (undef, undef, $props) = $self->ra->get_dir($old_path, $old_rev);
+ if (defined $props->{"svn:mergeinfo"}) {
+ my %omi = map {split ":", $_ } split "\n",
+ $props->{"svn:mergeinfo"};
+ $old_minfo = \%omi;
+ }
+ $self->{cached_mergeinfo_rev}{$old_path} = $old_rev;
# Cache the new mergeinfo.
- $self->{cached_mergeinfo}{$path} = \%minfo;
$self->{cached_mergeinfo_rev}{$path} = $rev;
my %changes = ();