##// END OF EJS Templates
vcsserver: added dedicated binary content check functions for all backends
dan -
r769:077cbac3 default
parent child Browse files
Show More
@@ -245,8 +245,8 b' class GitRemote(RemoteBase):'
245
245
246 @reraise_safe_exceptions
246 @reraise_safe_exceptions
247 def is_large_file(self, wire, commit_id):
247 def is_large_file(self, wire, commit_id):
248 cache_on, context_uid, repo_id = self._cache_on(wire)
248
249
249 cache_on, context_uid, repo_id = self._cache_on(wire)
250 @self.region.conditional_cache_on_arguments(condition=cache_on)
250 @self.region.conditional_cache_on_arguments(condition=cache_on)
251 def _is_large_file(_repo_id, _sha):
251 def _is_large_file(_repo_id, _sha):
252 repo_init = self._factory.repo_libgit2(wire)
252 repo_init = self._factory.repo_libgit2(wire)
@@ -260,6 +260,19 b' class GitRemote(RemoteBase):'
260 return _is_large_file(repo_id, commit_id)
260 return _is_large_file(repo_id, commit_id)
261
261
262 @reraise_safe_exceptions
262 @reraise_safe_exceptions
263 def is_binary(self, wire, tree_id):
264 cache_on, context_uid, repo_id = self._cache_on(wire)
265
266 @self.region.conditional_cache_on_arguments(condition=cache_on)
267 def _is_binary(_repo_id, _tree_id):
268 repo_init = self._factory.repo_libgit2(wire)
269 with repo_init as repo:
270 blob_obj = repo[tree_id]
271 return blob_obj.is_binary
272
273 return _is_binary(repo_id, tree_id)
274
275 @reraise_safe_exceptions
263 def in_largefiles_store(self, wire, oid):
276 def in_largefiles_store(self, wire, oid):
264 conf = self._wire_to_config(wire)
277 conf = self._wire_to_config(wire)
265 repo_init = self._factory.repo_libgit2(wire)
278 repo_init = self._factory.repo_libgit2(wire)
@@ -567,6 +567,19 b' class HgRemote(RemoteBase):'
567 return _is_large_file(context_uid, repo_id, path)
567 return _is_large_file(context_uid, repo_id, path)
568
568
569 @reraise_safe_exceptions
569 @reraise_safe_exceptions
570 def is_binary(self, wire, revision, path):
571 cache_on, context_uid, repo_id = self._cache_on(wire)
572
573 @self.region.conditional_cache_on_arguments(condition=cache_on)
574 def _is_binary(_repo_id, _sha, _path):
575 repo = self._factory.repo(wire)
576 ctx = self._get_ctx(repo, revision)
577 fctx = ctx.filectx(path)
578 return fctx.isbinary()
579
580 return _is_binary(repo_id, revision, path)
581
582 @reraise_safe_exceptions
570 def in_largefiles_store(self, wire, sha):
583 def in_largefiles_store(self, wire, sha):
571 repo = self._factory.repo(wire)
584 repo = self._factory.repo(wire)
572 return largefiles.lfutil.instore(repo, sha)
585 return largefiles.lfutil.instore(repo, sha)
@@ -472,6 +472,17 b' class SvnRemote(RemoteBase):'
472 return False
472 return False
473
473
474 @reraise_safe_exceptions
474 @reraise_safe_exceptions
475 def is_binary(self, wire, rev, path):
476 cache_on, context_uid, repo_id = self._cache_on(wire)
477
478 @self.region.conditional_cache_on_arguments(condition=cache_on)
479 def _is_binary(_repo_id, _rev, _path):
480 raw_bytes = self.get_file_content(wire, path, rev)
481 return raw_bytes and '\0' in raw_bytes
482
483 return _is_binary(repo_id, rev, path)
484
485 @reraise_safe_exceptions
475 def run_svn_command(self, wire, cmd, **opts):
486 def run_svn_command(self, wire, cmd, **opts):
476 path = wire.get('path', None)
487 path = wire.get('path', None)
477
488
General Comments 0
You need to be logged in to leave comments. Login now