##// END OF EJS Templates
caches: small naming refactor to fix tests.
super-admin -
r964:1fc3584c default
parent child Browse files
Show More
@@ -185,7 +185,7 b' class GitRemote(RemoteBase):'
185 @reraise_safe_exceptions
185 @reraise_safe_exceptions
186 def assert_correct_path(self, wire):
186 def assert_correct_path(self, wire):
187 cache_on, context_uid, repo_id = self._cache_on(wire)
187 cache_on, context_uid, repo_id = self._cache_on(wire)
188 region = self.region(wire)
188 region = self._region(wire)
189 @region.conditional_cache_on_arguments(condition=cache_on)
189 @region.conditional_cache_on_arguments(condition=cache_on)
190 def _assert_correct_path(_context_uid, _repo_id):
190 def _assert_correct_path(_context_uid, _repo_id):
191 try:
191 try:
@@ -218,7 +218,7 b' class GitRemote(RemoteBase):'
218 @reraise_safe_exceptions
218 @reraise_safe_exceptions
219 def blob_raw_length(self, wire, sha):
219 def blob_raw_length(self, wire, sha):
220 cache_on, context_uid, repo_id = self._cache_on(wire)
220 cache_on, context_uid, repo_id = self._cache_on(wire)
221 region = self.region(wire)
221 region = self._region(wire)
222 @region.conditional_cache_on_arguments(condition=cache_on)
222 @region.conditional_cache_on_arguments(condition=cache_on)
223 def _blob_raw_length(_repo_id, _sha):
223 def _blob_raw_length(_repo_id, _sha):
224
224
@@ -250,7 +250,7 b' class GitRemote(RemoteBase):'
250 def is_large_file(self, wire, commit_id):
250 def is_large_file(self, wire, commit_id):
251 cache_on, context_uid, repo_id = self._cache_on(wire)
251 cache_on, context_uid, repo_id = self._cache_on(wire)
252
252
253 region = self.region(wire)
253 region = self._region(wire)
254 @region.conditional_cache_on_arguments(condition=cache_on)
254 @region.conditional_cache_on_arguments(condition=cache_on)
255 def _is_large_file(_repo_id, _sha):
255 def _is_large_file(_repo_id, _sha):
256 repo_init = self._factory.repo_libgit2(wire)
256 repo_init = self._factory.repo_libgit2(wire)
@@ -267,7 +267,7 b' class GitRemote(RemoteBase):'
267 def is_binary(self, wire, tree_id):
267 def is_binary(self, wire, tree_id):
268 cache_on, context_uid, repo_id = self._cache_on(wire)
268 cache_on, context_uid, repo_id = self._cache_on(wire)
269
269
270 region = self.region(wire)
270 region = self._region(wire)
271 @region.conditional_cache_on_arguments(condition=cache_on)
271 @region.conditional_cache_on_arguments(condition=cache_on)
272 def _is_binary(_repo_id, _tree_id):
272 def _is_binary(_repo_id, _tree_id):
273 repo_init = self._factory.repo_libgit2(wire)
273 repo_init = self._factory.repo_libgit2(wire)
@@ -310,7 +310,7 b' class GitRemote(RemoteBase):'
310 @reraise_safe_exceptions
310 @reraise_safe_exceptions
311 def bulk_request(self, wire, rev, pre_load):
311 def bulk_request(self, wire, rev, pre_load):
312 cache_on, context_uid, repo_id = self._cache_on(wire)
312 cache_on, context_uid, repo_id = self._cache_on(wire)
313 region = self.region(wire)
313 region = self._region(wire)
314 @region.conditional_cache_on_arguments(condition=cache_on)
314 @region.conditional_cache_on_arguments(condition=cache_on)
315 def _bulk_request(_repo_id, _rev, _pre_load):
315 def _bulk_request(_repo_id, _rev, _pre_load):
316 result = {}
316 result = {}
@@ -414,7 +414,7 b' class GitRemote(RemoteBase):'
414 @reraise_safe_exceptions
414 @reraise_safe_exceptions
415 def branch(self, wire, commit_id):
415 def branch(self, wire, commit_id):
416 cache_on, context_uid, repo_id = self._cache_on(wire)
416 cache_on, context_uid, repo_id = self._cache_on(wire)
417 region = self.region(wire)
417 region = self._region(wire)
418 @region.conditional_cache_on_arguments(condition=cache_on)
418 @region.conditional_cache_on_arguments(condition=cache_on)
419 def _branch(_context_uid, _repo_id, _commit_id):
419 def _branch(_context_uid, _repo_id, _commit_id):
420 regex = re.compile('^refs/heads')
420 regex = re.compile('^refs/heads')
@@ -430,7 +430,7 b' class GitRemote(RemoteBase):'
430 @reraise_safe_exceptions
430 @reraise_safe_exceptions
431 def commit_branches(self, wire, commit_id):
431 def commit_branches(self, wire, commit_id):
432 cache_on, context_uid, repo_id = self._cache_on(wire)
432 cache_on, context_uid, repo_id = self._cache_on(wire)
433 region = self.region(wire)
433 region = self._region(wire)
434 @region.conditional_cache_on_arguments(condition=cache_on)
434 @region.conditional_cache_on_arguments(condition=cache_on)
435 def _commit_branches(_context_uid, _repo_id, _commit_id):
435 def _commit_branches(_context_uid, _repo_id, _commit_id):
436 repo_init = self._factory.repo_libgit2(wire)
436 repo_init = self._factory.repo_libgit2(wire)
@@ -697,7 +697,7 b' class GitRemote(RemoteBase):'
697 @reraise_safe_exceptions
697 @reraise_safe_exceptions
698 def get_object(self, wire, sha, maybe_unreachable=False):
698 def get_object(self, wire, sha, maybe_unreachable=False):
699 cache_on, context_uid, repo_id = self._cache_on(wire)
699 cache_on, context_uid, repo_id = self._cache_on(wire)
700 region = self.region(wire)
700 region = self._region(wire)
701 @region.conditional_cache_on_arguments(condition=cache_on)
701 @region.conditional_cache_on_arguments(condition=cache_on)
702 def _get_object(_context_uid, _repo_id, _sha):
702 def _get_object(_context_uid, _repo_id, _sha):
703 repo_init = self._factory.repo_libgit2(wire)
703 repo_init = self._factory.repo_libgit2(wire)
@@ -756,7 +756,7 b' class GitRemote(RemoteBase):'
756 @reraise_safe_exceptions
756 @reraise_safe_exceptions
757 def get_refs(self, wire):
757 def get_refs(self, wire):
758 cache_on, context_uid, repo_id = self._cache_on(wire)
758 cache_on, context_uid, repo_id = self._cache_on(wire)
759 region = self.region(wire)
759 region = self._region(wire)
760 @region.conditional_cache_on_arguments(condition=cache_on)
760 @region.conditional_cache_on_arguments(condition=cache_on)
761 def _get_refs(_context_uid, _repo_id):
761 def _get_refs(_context_uid, _repo_id):
762
762
@@ -771,7 +771,7 b' class GitRemote(RemoteBase):'
771 @reraise_safe_exceptions
771 @reraise_safe_exceptions
772 def get_branch_pointers(self, wire):
772 def get_branch_pointers(self, wire):
773 cache_on, context_uid, repo_id = self._cache_on(wire)
773 cache_on, context_uid, repo_id = self._cache_on(wire)
774 region = self.region(wire)
774 region = self._region(wire)
775 @region.conditional_cache_on_arguments(condition=cache_on)
775 @region.conditional_cache_on_arguments(condition=cache_on)
776 def _get_branch_pointers(_context_uid, _repo_id):
776 def _get_branch_pointers(_context_uid, _repo_id):
777
777
@@ -786,7 +786,7 b' class GitRemote(RemoteBase):'
786 @reraise_safe_exceptions
786 @reraise_safe_exceptions
787 def head(self, wire, show_exc=True):
787 def head(self, wire, show_exc=True):
788 cache_on, context_uid, repo_id = self._cache_on(wire)
788 cache_on, context_uid, repo_id = self._cache_on(wire)
789 region = self.region(wire)
789 region = self._region(wire)
790 @region.conditional_cache_on_arguments(condition=cache_on)
790 @region.conditional_cache_on_arguments(condition=cache_on)
791 def _head(_context_uid, _repo_id, _show_exc):
791 def _head(_context_uid, _repo_id, _show_exc):
792 repo_init = self._factory.repo_libgit2(wire)
792 repo_init = self._factory.repo_libgit2(wire)
@@ -812,7 +812,7 b' class GitRemote(RemoteBase):'
812 def revision(self, wire, rev):
812 def revision(self, wire, rev):
813
813
814 cache_on, context_uid, repo_id = self._cache_on(wire)
814 cache_on, context_uid, repo_id = self._cache_on(wire)
815 region = self.region(wire)
815 region = self._region(wire)
816 @region.conditional_cache_on_arguments(condition=cache_on)
816 @region.conditional_cache_on_arguments(condition=cache_on)
817 def _revision(_context_uid, _repo_id, _rev):
817 def _revision(_context_uid, _repo_id, _rev):
818 repo_init = self._factory.repo_libgit2(wire)
818 repo_init = self._factory.repo_libgit2(wire)
@@ -831,7 +831,7 b' class GitRemote(RemoteBase):'
831 @reraise_safe_exceptions
831 @reraise_safe_exceptions
832 def date(self, wire, commit_id):
832 def date(self, wire, commit_id):
833 cache_on, context_uid, repo_id = self._cache_on(wire)
833 cache_on, context_uid, repo_id = self._cache_on(wire)
834 region = self.region(wire)
834 region = self._region(wire)
835 @region.conditional_cache_on_arguments(condition=cache_on)
835 @region.conditional_cache_on_arguments(condition=cache_on)
836 def _date(_repo_id, _commit_id):
836 def _date(_repo_id, _commit_id):
837 repo_init = self._factory.repo_libgit2(wire)
837 repo_init = self._factory.repo_libgit2(wire)
@@ -851,7 +851,7 b' class GitRemote(RemoteBase):'
851 @reraise_safe_exceptions
851 @reraise_safe_exceptions
852 def author(self, wire, commit_id):
852 def author(self, wire, commit_id):
853 cache_on, context_uid, repo_id = self._cache_on(wire)
853 cache_on, context_uid, repo_id = self._cache_on(wire)
854 region = self.region(wire)
854 region = self._region(wire)
855 @region.conditional_cache_on_arguments(condition=cache_on)
855 @region.conditional_cache_on_arguments(condition=cache_on)
856 def _author(_repo_id, _commit_id):
856 def _author(_repo_id, _commit_id):
857 repo_init = self._factory.repo_libgit2(wire)
857 repo_init = self._factory.repo_libgit2(wire)
@@ -876,7 +876,7 b' class GitRemote(RemoteBase):'
876 @reraise_safe_exceptions
876 @reraise_safe_exceptions
877 def message(self, wire, commit_id):
877 def message(self, wire, commit_id):
878 cache_on, context_uid, repo_id = self._cache_on(wire)
878 cache_on, context_uid, repo_id = self._cache_on(wire)
879 region = self.region(wire)
879 region = self._region(wire)
880 @region.conditional_cache_on_arguments(condition=cache_on)
880 @region.conditional_cache_on_arguments(condition=cache_on)
881 def _message(_repo_id, _commit_id):
881 def _message(_repo_id, _commit_id):
882 repo_init = self._factory.repo_libgit2(wire)
882 repo_init = self._factory.repo_libgit2(wire)
@@ -888,7 +888,7 b' class GitRemote(RemoteBase):'
888 @reraise_safe_exceptions
888 @reraise_safe_exceptions
889 def parents(self, wire, commit_id):
889 def parents(self, wire, commit_id):
890 cache_on, context_uid, repo_id = self._cache_on(wire)
890 cache_on, context_uid, repo_id = self._cache_on(wire)
891 region = self.region(wire)
891 region = self._region(wire)
892 @region.conditional_cache_on_arguments(condition=cache_on)
892 @region.conditional_cache_on_arguments(condition=cache_on)
893 def _parents(_repo_id, _commit_id):
893 def _parents(_repo_id, _commit_id):
894 repo_init = self._factory.repo_libgit2(wire)
894 repo_init = self._factory.repo_libgit2(wire)
@@ -905,7 +905,7 b' class GitRemote(RemoteBase):'
905 @reraise_safe_exceptions
905 @reraise_safe_exceptions
906 def children(self, wire, commit_id):
906 def children(self, wire, commit_id):
907 cache_on, context_uid, repo_id = self._cache_on(wire)
907 cache_on, context_uid, repo_id = self._cache_on(wire)
908 region = self.region(wire)
908 region = self._region(wire)
909 @region.conditional_cache_on_arguments(condition=cache_on)
909 @region.conditional_cache_on_arguments(condition=cache_on)
910 def _children(_repo_id, _commit_id):
910 def _children(_repo_id, _commit_id):
911 output, __ = self.run_git_command(
911 output, __ = self.run_git_command(
@@ -965,7 +965,7 b' class GitRemote(RemoteBase):'
965 def tree_and_type_for_path(self, wire, commit_id, path):
965 def tree_and_type_for_path(self, wire, commit_id, path):
966
966
967 cache_on, context_uid, repo_id = self._cache_on(wire)
967 cache_on, context_uid, repo_id = self._cache_on(wire)
968 region = self.region(wire)
968 region = self._region(wire)
969 @region.conditional_cache_on_arguments(condition=cache_on)
969 @region.conditional_cache_on_arguments(condition=cache_on)
970 def _tree_and_type_for_path(_context_uid, _repo_id, _commit_id, _path):
970 def _tree_and_type_for_path(_context_uid, _repo_id, _commit_id, _path):
971 repo_init = self._factory.repo_libgit2(wire)
971 repo_init = self._factory.repo_libgit2(wire)
@@ -983,7 +983,7 b' class GitRemote(RemoteBase):'
983 @reraise_safe_exceptions
983 @reraise_safe_exceptions
984 def tree_items(self, wire, tree_id):
984 def tree_items(self, wire, tree_id):
985 cache_on, context_uid, repo_id = self._cache_on(wire)
985 cache_on, context_uid, repo_id = self._cache_on(wire)
986 region = self.region(wire)
986 region = self._region(wire)
987 @region.conditional_cache_on_arguments(condition=cache_on)
987 @region.conditional_cache_on_arguments(condition=cache_on)
988 def _tree_items(_repo_id, _tree_id):
988 def _tree_items(_repo_id, _tree_id):
989
989
@@ -1085,7 +1085,7 b' class GitRemote(RemoteBase):'
1085 @reraise_safe_exceptions
1085 @reraise_safe_exceptions
1086 def node_history(self, wire, commit_id, path, limit):
1086 def node_history(self, wire, commit_id, path, limit):
1087 cache_on, context_uid, repo_id = self._cache_on(wire)
1087 cache_on, context_uid, repo_id = self._cache_on(wire)
1088 region = self.region(wire)
1088 region = self._region(wire)
1089 @region.conditional_cache_on_arguments(condition=cache_on)
1089 @region.conditional_cache_on_arguments(condition=cache_on)
1090 def _node_history(_context_uid, _repo_id, _commit_id, _path, _limit):
1090 def _node_history(_context_uid, _repo_id, _commit_id, _path, _limit):
1091 # optimize for n==1, rev-list is much faster for that use-case
1091 # optimize for n==1, rev-list is much faster for that use-case
@@ -1128,7 +1128,7 b' class GitRemote(RemoteBase):'
1128 def get_all_commit_ids(self, wire):
1128 def get_all_commit_ids(self, wire):
1129
1129
1130 cache_on, context_uid, repo_id = self._cache_on(wire)
1130 cache_on, context_uid, repo_id = self._cache_on(wire)
1131 region = self.region(wire)
1131 region = self._region(wire)
1132 @region.conditional_cache_on_arguments(condition=cache_on)
1132 @region.conditional_cache_on_arguments(condition=cache_on)
1133 def _get_all_commit_ids(_context_uid, _repo_id):
1133 def _get_all_commit_ids(_context_uid, _repo_id):
1134
1134
@@ -209,7 +209,7 b' class HgRemote(RemoteBase):'
209 @reraise_safe_exceptions
209 @reraise_safe_exceptions
210 def bookmarks(self, wire):
210 def bookmarks(self, wire):
211 cache_on, context_uid, repo_id = self._cache_on(wire)
211 cache_on, context_uid, repo_id = self._cache_on(wire)
212 region = self.region(wire)
212 region = self._region(wire)
213 @region.conditional_cache_on_arguments(condition=cache_on)
213 @region.conditional_cache_on_arguments(condition=cache_on)
214 def _bookmarks(_context_uid, _repo_id):
214 def _bookmarks(_context_uid, _repo_id):
215 repo = self._factory.repo(wire)
215 repo = self._factory.repo(wire)
@@ -220,7 +220,7 b' class HgRemote(RemoteBase):'
220 @reraise_safe_exceptions
220 @reraise_safe_exceptions
221 def branches(self, wire, normal, closed):
221 def branches(self, wire, normal, closed):
222 cache_on, context_uid, repo_id = self._cache_on(wire)
222 cache_on, context_uid, repo_id = self._cache_on(wire)
223 region = self.region(wire)
223 region = self._region(wire)
224 @region.conditional_cache_on_arguments(condition=cache_on)
224 @region.conditional_cache_on_arguments(condition=cache_on)
225 def _branches(_context_uid, _repo_id, _normal, _closed):
225 def _branches(_context_uid, _repo_id, _normal, _closed):
226 repo = self._factory.repo(wire)
226 repo = self._factory.repo(wire)
@@ -239,7 +239,7 b' class HgRemote(RemoteBase):'
239 @reraise_safe_exceptions
239 @reraise_safe_exceptions
240 def bulk_request(self, wire, commit_id, pre_load):
240 def bulk_request(self, wire, commit_id, pre_load):
241 cache_on, context_uid, repo_id = self._cache_on(wire)
241 cache_on, context_uid, repo_id = self._cache_on(wire)
242 region = self.region(wire)
242 region = self._region(wire)
243 @region.conditional_cache_on_arguments(condition=cache_on)
243 @region.conditional_cache_on_arguments(condition=cache_on)
244 def _bulk_request(_repo_id, _commit_id, _pre_load):
244 def _bulk_request(_repo_id, _commit_id, _pre_load):
245 result = {}
245 result = {}
@@ -257,7 +257,7 b' class HgRemote(RemoteBase):'
257 @reraise_safe_exceptions
257 @reraise_safe_exceptions
258 def ctx_branch(self, wire, commit_id):
258 def ctx_branch(self, wire, commit_id):
259 cache_on, context_uid, repo_id = self._cache_on(wire)
259 cache_on, context_uid, repo_id = self._cache_on(wire)
260 region = self.region(wire)
260 region = self._region(wire)
261 @region.conditional_cache_on_arguments(condition=cache_on)
261 @region.conditional_cache_on_arguments(condition=cache_on)
262 def _ctx_branch(_repo_id, _commit_id):
262 def _ctx_branch(_repo_id, _commit_id):
263 repo = self._factory.repo(wire)
263 repo = self._factory.repo(wire)
@@ -268,7 +268,7 b' class HgRemote(RemoteBase):'
268 @reraise_safe_exceptions
268 @reraise_safe_exceptions
269 def ctx_date(self, wire, commit_id):
269 def ctx_date(self, wire, commit_id):
270 cache_on, context_uid, repo_id = self._cache_on(wire)
270 cache_on, context_uid, repo_id = self._cache_on(wire)
271 region = self.region(wire)
271 region = self._region(wire)
272 @region.conditional_cache_on_arguments(condition=cache_on)
272 @region.conditional_cache_on_arguments(condition=cache_on)
273 def _ctx_date(_repo_id, _commit_id):
273 def _ctx_date(_repo_id, _commit_id):
274 repo = self._factory.repo(wire)
274 repo = self._factory.repo(wire)
@@ -285,7 +285,7 b' class HgRemote(RemoteBase):'
285 @reraise_safe_exceptions
285 @reraise_safe_exceptions
286 def ctx_files(self, wire, commit_id):
286 def ctx_files(self, wire, commit_id):
287 cache_on, context_uid, repo_id = self._cache_on(wire)
287 cache_on, context_uid, repo_id = self._cache_on(wire)
288 region = self.region(wire)
288 region = self._region(wire)
289 @region.conditional_cache_on_arguments(condition=cache_on)
289 @region.conditional_cache_on_arguments(condition=cache_on)
290 def _ctx_files(_repo_id, _commit_id):
290 def _ctx_files(_repo_id, _commit_id):
291 repo = self._factory.repo(wire)
291 repo = self._factory.repo(wire)
@@ -303,7 +303,7 b' class HgRemote(RemoteBase):'
303 @reraise_safe_exceptions
303 @reraise_safe_exceptions
304 def ctx_parents(self, wire, commit_id):
304 def ctx_parents(self, wire, commit_id):
305 cache_on, context_uid, repo_id = self._cache_on(wire)
305 cache_on, context_uid, repo_id = self._cache_on(wire)
306 region = self.region(wire)
306 region = self._region(wire)
307 @region.conditional_cache_on_arguments(condition=cache_on)
307 @region.conditional_cache_on_arguments(condition=cache_on)
308 def _ctx_parents(_repo_id, _commit_id):
308 def _ctx_parents(_repo_id, _commit_id):
309 repo = self._factory.repo(wire)
309 repo = self._factory.repo(wire)
@@ -316,7 +316,7 b' class HgRemote(RemoteBase):'
316 @reraise_safe_exceptions
316 @reraise_safe_exceptions
317 def ctx_children(self, wire, commit_id):
317 def ctx_children(self, wire, commit_id):
318 cache_on, context_uid, repo_id = self._cache_on(wire)
318 cache_on, context_uid, repo_id = self._cache_on(wire)
319 region = self.region(wire)
319 region = self._region(wire)
320 @region.conditional_cache_on_arguments(condition=cache_on)
320 @region.conditional_cache_on_arguments(condition=cache_on)
321 def _ctx_children(_repo_id, _commit_id):
321 def _ctx_children(_repo_id, _commit_id):
322 repo = self._factory.repo(wire)
322 repo = self._factory.repo(wire)
@@ -329,7 +329,7 b' class HgRemote(RemoteBase):'
329 @reraise_safe_exceptions
329 @reraise_safe_exceptions
330 def ctx_phase(self, wire, commit_id):
330 def ctx_phase(self, wire, commit_id):
331 cache_on, context_uid, repo_id = self._cache_on(wire)
331 cache_on, context_uid, repo_id = self._cache_on(wire)
332 region = self.region(wire)
332 region = self._region(wire)
333 @region.conditional_cache_on_arguments(condition=cache_on)
333 @region.conditional_cache_on_arguments(condition=cache_on)
334 def _ctx_phase(_context_uid, _repo_id, _commit_id):
334 def _ctx_phase(_context_uid, _repo_id, _commit_id):
335 repo = self._factory.repo(wire)
335 repo = self._factory.repo(wire)
@@ -341,7 +341,7 b' class HgRemote(RemoteBase):'
341 @reraise_safe_exceptions
341 @reraise_safe_exceptions
342 def ctx_obsolete(self, wire, commit_id):
342 def ctx_obsolete(self, wire, commit_id):
343 cache_on, context_uid, repo_id = self._cache_on(wire)
343 cache_on, context_uid, repo_id = self._cache_on(wire)
344 region = self.region(wire)
344 region = self._region(wire)
345 @region.conditional_cache_on_arguments(condition=cache_on)
345 @region.conditional_cache_on_arguments(condition=cache_on)
346 def _ctx_obsolete(_context_uid, _repo_id, _commit_id):
346 def _ctx_obsolete(_context_uid, _repo_id, _commit_id):
347 repo = self._factory.repo(wire)
347 repo = self._factory.repo(wire)
@@ -352,7 +352,7 b' class HgRemote(RemoteBase):'
352 @reraise_safe_exceptions
352 @reraise_safe_exceptions
353 def ctx_hidden(self, wire, commit_id):
353 def ctx_hidden(self, wire, commit_id):
354 cache_on, context_uid, repo_id = self._cache_on(wire)
354 cache_on, context_uid, repo_id = self._cache_on(wire)
355 region = self.region(wire)
355 region = self._region(wire)
356 @region.conditional_cache_on_arguments(condition=cache_on)
356 @region.conditional_cache_on_arguments(condition=cache_on)
357 def _ctx_hidden(_context_uid, _repo_id, _commit_id):
357 def _ctx_hidden(_context_uid, _repo_id, _commit_id):
358 repo = self._factory.repo(wire)
358 repo = self._factory.repo(wire)
@@ -466,7 +466,7 b' class HgRemote(RemoteBase):'
466 @reraise_safe_exceptions
466 @reraise_safe_exceptions
467 def node_history(self, wire, revision, path, limit):
467 def node_history(self, wire, revision, path, limit):
468 cache_on, context_uid, repo_id = self._cache_on(wire)
468 cache_on, context_uid, repo_id = self._cache_on(wire)
469 region = self.region(wire)
469 region = self._region(wire)
470 @region.conditional_cache_on_arguments(condition=cache_on)
470 @region.conditional_cache_on_arguments(condition=cache_on)
471 def _node_history(_context_uid, _repo_id, _revision, _path, _limit):
471 def _node_history(_context_uid, _repo_id, _revision, _path, _limit):
472 repo = self._factory.repo(wire)
472 repo = self._factory.repo(wire)
@@ -497,7 +497,7 b' class HgRemote(RemoteBase):'
497 @reraise_safe_exceptions
497 @reraise_safe_exceptions
498 def node_history_untill(self, wire, revision, path, limit):
498 def node_history_untill(self, wire, revision, path, limit):
499 cache_on, context_uid, repo_id = self._cache_on(wire)
499 cache_on, context_uid, repo_id = self._cache_on(wire)
500 region = self.region(wire)
500 region = self._region(wire)
501 @region.conditional_cache_on_arguments(condition=cache_on)
501 @region.conditional_cache_on_arguments(condition=cache_on)
502 def _node_history_until(_context_uid, _repo_id):
502 def _node_history_until(_context_uid, _repo_id):
503 repo = self._factory.repo(wire)
503 repo = self._factory.repo(wire)
@@ -536,7 +536,7 b' class HgRemote(RemoteBase):'
536 @reraise_safe_exceptions
536 @reraise_safe_exceptions
537 def fctx_flags(self, wire, commit_id, path):
537 def fctx_flags(self, wire, commit_id, path):
538 cache_on, context_uid, repo_id = self._cache_on(wire)
538 cache_on, context_uid, repo_id = self._cache_on(wire)
539 region = self.region(wire)
539 region = self._region(wire)
540 @region.conditional_cache_on_arguments(condition=cache_on)
540 @region.conditional_cache_on_arguments(condition=cache_on)
541 def _fctx_flags(_repo_id, _commit_id, _path):
541 def _fctx_flags(_repo_id, _commit_id, _path):
542 repo = self._factory.repo(wire)
542 repo = self._factory.repo(wire)
@@ -549,7 +549,7 b' class HgRemote(RemoteBase):'
549 @reraise_safe_exceptions
549 @reraise_safe_exceptions
550 def fctx_size(self, wire, commit_id, path):
550 def fctx_size(self, wire, commit_id, path):
551 cache_on, context_uid, repo_id = self._cache_on(wire)
551 cache_on, context_uid, repo_id = self._cache_on(wire)
552 region = self.region(wire)
552 region = self._region(wire)
553 @region.conditional_cache_on_arguments(condition=cache_on)
553 @region.conditional_cache_on_arguments(condition=cache_on)
554 def _fctx_size(_repo_id, _revision, _path):
554 def _fctx_size(_repo_id, _revision, _path):
555 repo = self._factory.repo(wire)
555 repo = self._factory.repo(wire)
@@ -561,7 +561,7 b' class HgRemote(RemoteBase):'
561 @reraise_safe_exceptions
561 @reraise_safe_exceptions
562 def get_all_commit_ids(self, wire, name):
562 def get_all_commit_ids(self, wire, name):
563 cache_on, context_uid, repo_id = self._cache_on(wire)
563 cache_on, context_uid, repo_id = self._cache_on(wire)
564 region = self.region(wire)
564 region = self._region(wire)
565 @region.conditional_cache_on_arguments(condition=cache_on)
565 @region.conditional_cache_on_arguments(condition=cache_on)
566 def _get_all_commit_ids(_context_uid, _repo_id, _name):
566 def _get_all_commit_ids(_context_uid, _repo_id, _name):
567 repo = self._factory.repo(wire)
567 repo = self._factory.repo(wire)
@@ -578,7 +578,7 b' class HgRemote(RemoteBase):'
578 @reraise_safe_exceptions
578 @reraise_safe_exceptions
579 def is_large_file(self, wire, commit_id, path):
579 def is_large_file(self, wire, commit_id, path):
580 cache_on, context_uid, repo_id = self._cache_on(wire)
580 cache_on, context_uid, repo_id = self._cache_on(wire)
581 region = self.region(wire)
581 region = self._region(wire)
582 @region.conditional_cache_on_arguments(condition=cache_on)
582 @region.conditional_cache_on_arguments(condition=cache_on)
583 def _is_large_file(_context_uid, _repo_id, _commit_id, _path):
583 def _is_large_file(_context_uid, _repo_id, _commit_id, _path):
584 return largefiles.lfutil.isstandin(path)
584 return largefiles.lfutil.isstandin(path)
@@ -589,7 +589,7 b' class HgRemote(RemoteBase):'
589 def is_binary(self, wire, revision, path):
589 def is_binary(self, wire, revision, path):
590 cache_on, context_uid, repo_id = self._cache_on(wire)
590 cache_on, context_uid, repo_id = self._cache_on(wire)
591
591
592 region = self.region(wire)
592 region = self._region(wire)
593 @region.conditional_cache_on_arguments(condition=cache_on)
593 @region.conditional_cache_on_arguments(condition=cache_on)
594 def _is_binary(_repo_id, _sha, _path):
594 def _is_binary(_repo_id, _sha, _path):
595 repo = self._factory.repo(wire)
595 repo = self._factory.repo(wire)
@@ -628,7 +628,7 b' class HgRemote(RemoteBase):'
628 def lookup(self, wire, revision, both):
628 def lookup(self, wire, revision, both):
629 cache_on, context_uid, repo_id = self._cache_on(wire)
629 cache_on, context_uid, repo_id = self._cache_on(wire)
630
630
631 region = self.region(wire)
631 region = self._region(wire)
632 @region.conditional_cache_on_arguments(condition=cache_on)
632 @region.conditional_cache_on_arguments(condition=cache_on)
633 def _lookup(_context_uid, _repo_id, _revision, _both):
633 def _lookup(_context_uid, _repo_id, _revision, _both):
634
634
@@ -687,7 +687,7 b' class HgRemote(RemoteBase):'
687 def rev_range(self, wire, commit_filter):
687 def rev_range(self, wire, commit_filter):
688 cache_on, context_uid, repo_id = self._cache_on(wire)
688 cache_on, context_uid, repo_id = self._cache_on(wire)
689
689
690 region = self.region(wire)
690 region = self._region(wire)
691 @region.conditional_cache_on_arguments(condition=cache_on)
691 @region.conditional_cache_on_arguments(condition=cache_on)
692 def _rev_range(_context_uid, _repo_id, _filter):
692 def _rev_range(_context_uid, _repo_id, _filter):
693 repo = self._factory.repo(wire)
693 repo = self._factory.repo(wire)
@@ -763,7 +763,7 b' class HgRemote(RemoteBase):'
763 @reraise_safe_exceptions
763 @reraise_safe_exceptions
764 def tags(self, wire):
764 def tags(self, wire):
765 cache_on, context_uid, repo_id = self._cache_on(wire)
765 cache_on, context_uid, repo_id = self._cache_on(wire)
766 region = self.region(wire)
766 region = self._region(wire)
767 @region.conditional_cache_on_arguments(condition=cache_on)
767 @region.conditional_cache_on_arguments(condition=cache_on)
768 def _tags(_context_uid, _repo_id):
768 def _tags(_context_uid, _repo_id):
769 repo = self._factory.repo(wire)
769 repo = self._factory.repo(wire)
@@ -201,7 +201,7 b' class SvnRemote(RemoteBase):'
201 def revision_properties(self, wire, revision):
201 def revision_properties(self, wire, revision):
202
202
203 cache_on, context_uid, repo_id = self._cache_on(wire)
203 cache_on, context_uid, repo_id = self._cache_on(wire)
204 region = self.region(wire)
204 region = self._region(wire)
205 @region.conditional_cache_on_arguments(condition=cache_on)
205 @region.conditional_cache_on_arguments(condition=cache_on)
206 def _revision_properties(_repo_id, _revision):
206 def _revision_properties(_repo_id, _revision):
207 repo = self._factory.repo(wire)
207 repo = self._factory.repo(wire)
@@ -256,7 +256,7 b' class SvnRemote(RemoteBase):'
256 @reraise_safe_exceptions
256 @reraise_safe_exceptions
257 def node_history(self, wire, path, revision, limit):
257 def node_history(self, wire, path, revision, limit):
258 cache_on, context_uid, repo_id = self._cache_on(wire)
258 cache_on, context_uid, repo_id = self._cache_on(wire)
259 region = self.region(wire)
259 region = self._region(wire)
260 @region.conditional_cache_on_arguments(condition=cache_on)
260 @region.conditional_cache_on_arguments(condition=cache_on)
261 def _assert_correct_path(_context_uid, _repo_id, _path, _revision, _limit):
261 def _assert_correct_path(_context_uid, _repo_id, _path, _revision, _limit):
262 cross_copies = False
262 cross_copies = False
@@ -278,7 +278,7 b' class SvnRemote(RemoteBase):'
278
278
279 def node_properties(self, wire, path, revision):
279 def node_properties(self, wire, path, revision):
280 cache_on, context_uid, repo_id = self._cache_on(wire)
280 cache_on, context_uid, repo_id = self._cache_on(wire)
281 region = self.region(wire)
281 region = self._region(wire)
282 @region.conditional_cache_on_arguments(condition=cache_on)
282 @region.conditional_cache_on_arguments(condition=cache_on)
283 def _node_properties(_repo_id, _path, _revision):
283 def _node_properties(_repo_id, _path, _revision):
284 repo = self._factory.repo(wire)
284 repo = self._factory.repo(wire)
@@ -317,7 +317,7 b' class SvnRemote(RemoteBase):'
317 def get_node_type(self, wire, path, revision=None):
317 def get_node_type(self, wire, path, revision=None):
318
318
319 cache_on, context_uid, repo_id = self._cache_on(wire)
319 cache_on, context_uid, repo_id = self._cache_on(wire)
320 region = self.region(wire)
320 region = self._region(wire)
321 @region.conditional_cache_on_arguments(condition=cache_on)
321 @region.conditional_cache_on_arguments(condition=cache_on)
322 def _get_node_type(_repo_id, _path, _revision):
322 def _get_node_type(_repo_id, _path, _revision):
323 repo = self._factory.repo(wire)
323 repo = self._factory.repo(wire)
@@ -332,7 +332,7 b' class SvnRemote(RemoteBase):'
332 def get_nodes(self, wire, path, revision=None):
332 def get_nodes(self, wire, path, revision=None):
333
333
334 cache_on, context_uid, repo_id = self._cache_on(wire)
334 cache_on, context_uid, repo_id = self._cache_on(wire)
335 region = self.region(wire)
335 region = self._region(wire)
336 @region.conditional_cache_on_arguments(condition=cache_on)
336 @region.conditional_cache_on_arguments(condition=cache_on)
337 def _get_nodes(_repo_id, _path, _revision):
337 def _get_nodes(_repo_id, _path, _revision):
338 repo = self._factory.repo(wire)
338 repo = self._factory.repo(wire)
@@ -360,7 +360,7 b' class SvnRemote(RemoteBase):'
360 def get_file_size(self, wire, path, revision=None):
360 def get_file_size(self, wire, path, revision=None):
361
361
362 cache_on, context_uid, repo_id = self._cache_on(wire)
362 cache_on, context_uid, repo_id = self._cache_on(wire)
363 region = self.region(wire)
363 region = self._region(wire)
364 @region.conditional_cache_on_arguments(condition=cache_on)
364 @region.conditional_cache_on_arguments(condition=cache_on)
365 def _get_file_size(_repo_id, _path, _revision):
365 def _get_file_size(_repo_id, _path, _revision):
366 repo = self._factory.repo(wire)
366 repo = self._factory.repo(wire)
@@ -476,7 +476,7 b' class SvnRemote(RemoteBase):'
476 def is_binary(self, wire, rev, path):
476 def is_binary(self, wire, rev, path):
477 cache_on, context_uid, repo_id = self._cache_on(wire)
477 cache_on, context_uid, repo_id = self._cache_on(wire)
478
478
479 region = self.region(wire)
479 region = self._region(wire)
480 @region.conditional_cache_on_arguments(condition=cache_on)
480 @region.conditional_cache_on_arguments(condition=cache_on)
481 def _is_binary(_repo_id, _rev, _path):
481 def _is_binary(_repo_id, _rev, _path):
482 raw_bytes = self.get_file_content(wire, path, rev)
482 raw_bytes = self.get_file_content(wire, path, rev)
@@ -113,7 +113,7 b' class TestReraiseSafeExceptions(object):'
113
113
114 methods = inspect.getmembers(git_remote, predicate=inspect.ismethod)
114 methods = inspect.getmembers(git_remote, predicate=inspect.ismethod)
115 for method_name, method in methods:
115 for method_name, method in methods:
116 if not method_name.startswith('_'):
116 if not method_name.startswith('_') and method_name not in ['vcsserver_invalidate_cache']:
117 assert method.im_func.__code__ == decorator.__code__
117 assert method.im_func.__code__ == decorator.__code__
118
118
119 @pytest.mark.parametrize('side_effect, expected_type', [
119 @pytest.mark.parametrize('side_effect, expected_type', [
@@ -50,7 +50,7 b' class TestReraiseSafeExceptions(object):'
50 methods = inspect.getmembers(hg_remote, predicate=inspect.ismethod)
50 methods = inspect.getmembers(hg_remote, predicate=inspect.ismethod)
51 decorator = hg.reraise_safe_exceptions(None)
51 decorator = hg.reraise_safe_exceptions(None)
52 for method_name, method in methods:
52 for method_name, method in methods:
53 if not method_name.startswith('_'):
53 if not method_name.startswith('_') and method_name not in ['vcsserver_invalidate_cache']:
54 assert method.im_func.__code__ == decorator.__code__
54 assert method.im_func.__code__ == decorator.__code__
55
55
56 @pytest.mark.parametrize('side_effect, expected_type', [
56 @pytest.mark.parametrize('side_effect, expected_type', [
@@ -20,7 +20,7 b' from vcsserver.lib import rc_cache'
20 class RemoteBase(object):
20 class RemoteBase(object):
21 EMPTY_COMMIT = '0' * 40
21 EMPTY_COMMIT = '0' * 40
22
22
23 def region(self, wire):
23 def _region(self, wire):
24 repo_id = wire.get('repo_id', '')
24 repo_id = wire.get('repo_id', '')
25 cache_namespace_uid = 'cache_repo.{}'.format(repo_id)
25 cache_namespace_uid = 'cache_repo.{}'.format(repo_id)
26 return rc_cache.get_or_create_region('repo_object', cache_namespace_uid)
26 return rc_cache.get_or_create_region('repo_object', cache_namespace_uid)
General Comments 0
You need to be logged in to leave comments. Login now