Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-svn: reduce check_cherry_pick cache overhead
author
Eric Wong
<normalperson@yhbt.net>
Sun, 19 Oct 2014 04:08:31 +0000
(
04:08
+0000)
committer
Eric Wong
<normalperson@yhbt.net>
Fri, 24 Oct 2014 22:55:35 +0000
(22:55 +0000)
We do not need to store entire lists of commits, only the
number of incomplete and the first commit for reference.
This reduces the amount of data we need to store in memory
and on disk stores.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
perl/Git/SVN.pm
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
9ee13a9
)
diff --git
a/perl/Git/SVN.pm
b/perl/Git/SVN.pm
index b1a84d03cbaad657f7ef69f5e1c213ef6ea0e641..171af37f4a66f9be500148720c8f4b7f036338d5 100644
(file)
--- a/
perl/Git/SVN.pm
+++ b/
perl/Git/SVN.pm
@@
-1537,7
+1537,7
@@
sub _rev_list {
@rv;
}
@rv;
}
-sub check_cherry_pick {
+sub check_cherry_pick
2
{
my $base = shift;
my $tip = shift;
my $parents = shift;
my $base = shift;
my $tip = shift;
my $parents = shift;
@@
-1552,7
+1552,8
@@
sub check_cherry_pick {
delete $commits{$commit};
}
}
delete $commits{$commit};
}
}
- return (keys %commits);
+ my @k = (keys %commits);
+ return (scalar @k, $k[0]);
}
sub has_no_changes {
}
sub has_no_changes {
@@
-1597,7
+1598,7
@@
sub tie_for_persistent_memoization {
mkpath([$cache_path]) unless -d $cache_path;
my %lookup_svn_merge_cache;
mkpath([$cache_path]) unless -d $cache_path;
my %lookup_svn_merge_cache;
- my %check_cherry_pick_cache;
+ my %check_cherry_pick
2
_cache;
my %has_no_changes_cache;
my %_rev_list_cache;
my %has_no_changes_cache;
my %_rev_list_cache;
@@
-1608,11
+1609,11
@@
sub tie_for_persistent_memoization {
LIST_CACHE => ['HASH' => \%lookup_svn_merge_cache],
;
LIST_CACHE => ['HASH' => \%lookup_svn_merge_cache],
;
- tie_for_persistent_memoization(\%check_cherry_pick_cache,
- "$cache_path/check_cherry_pick");
- memoize 'check_cherry_pick',
+ tie_for_persistent_memoization(\%check_cherry_pick
2
_cache,
+ "$cache_path/check_cherry_pick
2
");
+ memoize 'check_cherry_pick
2
',
SCALAR_CACHE => 'FAULT',
SCALAR_CACHE => 'FAULT',
- LIST_CACHE => ['HASH' => \%check_cherry_pick_cache],
+ LIST_CACHE => ['HASH' => \%check_cherry_pick
2
_cache],
;
tie_for_persistent_memoization(\%has_no_changes_cache,
;
tie_for_persistent_memoization(\%has_no_changes_cache,
@@
-1636,7
+1637,7
@@
sub tie_for_persistent_memoization {
$memoized = 0;
Memoize::unmemoize 'lookup_svn_merge';
$memoized = 0;
Memoize::unmemoize 'lookup_svn_merge';
- Memoize::unmemoize 'check_cherry_pick';
+ Memoize::unmemoize 'check_cherry_pick
2
';
Memoize::unmemoize 'has_no_changes';
Memoize::unmemoize '_rev_list';
}
Memoize::unmemoize 'has_no_changes';
Memoize::unmemoize '_rev_list';
}
@@
-1648,7
+1649,8
@@
sub tie_for_persistent_memoization {
return unless -d $cache_path;
for my $cache_file (("$cache_path/lookup_svn_merge",
return unless -d $cache_path;
for my $cache_file (("$cache_path/lookup_svn_merge",
- "$cache_path/check_cherry_pick",
+ "$cache_path/check_cherry_pick", # old
+ "$cache_path/check_cherry_pick2",
"$cache_path/has_no_changes")) {
for my $suffix (qw(yaml db)) {
my $file = "$cache_file.$suffix";
"$cache_path/has_no_changes")) {
for my $suffix (qw(yaml db)) {
my $file = "$cache_file.$suffix";
@@
-1817,15
+1819,15
@@
sub find_extra_svn_parents {
}
# double check that there are no missing non-merge commits
}
# double check that there are no missing non-merge commits
- my (
@incomplete) = check_cherry_pick
(
+ my (
$ninc, $ifirst) = check_cherry_pick2
(
$merge_base, $merge_tip,
$parents,
@all_ranges,
);
$merge_base, $merge_tip,
$parents,
@all_ranges,
);
- if (
@incomplete
) {
- warn "W:svn cherry-pick ignored ($spec) - missing "
-
.@incomplete." commit(s) (eg $incomplete[0]
)\n";
+ if (
$ninc
) {
+ warn "W:svn cherry-pick ignored ($spec) - missing "
.
+
"$ninc commit(s) (eg $ifirst
)\n";
} else {
warn
"Found merge parent ($spec): ",
} else {
warn
"Found merge parent ($spec): ",