##// END OF EJS Templates
diff-cache: use bz2 to reduce diff-cache size.
marcink -
r2690:01439ec4 default
parent child Browse files
Show More
@@ -25,11 +25,12 b' Set of diffing helpers, previously part '
25
25
26 import os
26 import os
27 import re
27 import re
28 import bz2
29
28 import collections
30 import collections
29 import difflib
31 import difflib
30 import logging
32 import logging
31 import cPickle as pickle
33 import cPickle as pickle
32
33 from itertools import tee, imap
34 from itertools import tee, imap
34
35
35 from rhodecode.lib.vcs.exceptions import VCSError
36 from rhodecode.lib.vcs.exceptions import VCSError
@@ -1142,7 +1143,7 b' def cache_diff(cached_diff_file, diff, c'
1142 }
1143 }
1143
1144
1144 try:
1145 try:
1145 with open(cached_diff_file, 'wb') as f:
1146 with bz2.BZ2File(cached_diff_file, 'wb') as f:
1146 pickle.dump(struct, f)
1147 pickle.dump(struct, f)
1147 log.debug('Saved diff cache under %s', cached_diff_file)
1148 log.debug('Saved diff cache under %s', cached_diff_file)
1148 except Exception:
1149 except Exception:
@@ -1168,7 +1169,7 b' def load_cached_diff(cached_diff_file):'
1168
1169
1169 data = None
1170 data = None
1170 try:
1171 try:
1171 with open(cached_diff_file, 'rb') as f:
1172 with bz2.BZ2File(cached_diff_file, 'rb') as f:
1172 data = pickle.load(f)
1173 data = pickle.load(f)
1173 log.debug('Loaded diff cache from %s', cached_diff_file)
1174 log.debug('Loaded diff cache from %s', cached_diff_file)
1174 except Exception:
1175 except Exception:
General Comments 0
You need to be logged in to leave comments. Login now