##// END OF EJS Templates
http-protocol: Invalidate the VCSServer cache when calling a writing method.
Martin Bornhold -
r405:6ab62426 default
parent child Browse files
Show More
@@ -84,6 +84,18 b' class RepoMaker(object):'
84
84
85 class RemoteRepo(object):
85 class RemoteRepo(object):
86
86
87 # List of method names that act like a write to the repository. After these
88 # methods we have to invalidate the VCSServer cache.
89 _writing_methods = [
90 'bookmark',
91 'commit',
92 'pull',
93 'pull_cmd',
94 'push',
95 'rebase',
96 'strip',
97 ]
98
87 def __init__(self, path, config, url, session, with_wire=None):
99 def __init__(self, path, config, url, session, with_wire=None):
88 self.url = url
100 self.url = url
89 self._session = session
101 self._session = session
@@ -116,7 +128,15 b' class RemoteRepo(object):'
116 'method': name,
128 'method': name,
117 'params': {'wire': wire, 'args': args, 'kwargs': kwargs}
129 'params': {'wire': wire, 'args': args, 'kwargs': kwargs}
118 }
130 }
119 return _remote_call(self.url, payload, EXCEPTIONS_MAP, self._session)
131
132 try:
133 response = _remote_call(
134 self.url, payload, EXCEPTIONS_MAP, self._session)
135 finally:
136 if name in self._writing_methods:
137 self.invalidate_vcs_cache()
138
139 return response
120
140
121 def _call_with_logging(self, name, *args, **kwargs):
141 def _call_with_logging(self, name, *args, **kwargs):
122 log.debug('Calling %s@%s', self.url, name)
142 log.debug('Calling %s@%s', self.url, name)
General Comments 0
You need to be logged in to leave comments. Login now