##// END OF EJS Templates
vcs: added similar assert_path method as other backend have for API consistency
super-admin -
r1311:6c127320 default
parent child Browse files
Show More
@@ -23,6 +23,7 b' import sys'
23 23 import urllib.request
24 24 import urllib.parse
25 25 import hashlib
26 import traceback
26 27
27 28 from hgext import largefiles, rebase
28 29
@@ -759,6 +760,24 b' class HgRemote(RemoteBase):'
759 760 self._factory.repo(wire, create=create)
760 761
761 762 @reraise_safe_exceptions
763 def assert_correct_path(self, wire):
764 cache_on, context_uid, repo_id = self._cache_on(wire)
765 region = self._region(wire)
766
767 @region.conditional_cache_on_arguments(condition=cache_on)
768 def _assert_correct_path(_context_uid, _repo_id):
769 try:
770 self._factory.repo(wire, create=False)
771 except Exception:
772 path = wire.get('path')
773 tb = traceback.format_exc()
774 log.debug("Invalid Mercurial path `%s`, tb: %s", path, tb)
775 return False
776 return True
777
778 return _assert_correct_path(context_uid, repo_id)
779
780 @reraise_safe_exceptions
762 781 def lookup(self, wire, revision, both):
763 782 cache_on, context_uid, repo_id = self._cache_on(wire)
764 783 region = self._region(wire)
General Comments 0
You need to be logged in to leave comments. Login now