diff --git a/rhodecode/lib/vcs/client_http.py b/rhodecode/lib/vcs/client_http.py --- a/rhodecode/lib/vcs/client_http.py +++ b/rhodecode/lib/vcs/client_http.py @@ -84,6 +84,18 @@ class RepoMaker(object): class RemoteRepo(object): + # List of method names that act like a write to the repository. After these + # methods we have to invalidate the VCSServer cache. + _writing_methods = [ + 'bookmark', + 'commit', + 'pull', + 'pull_cmd', + 'push', + 'rebase', + 'strip', + ] + def __init__(self, path, config, url, session, with_wire=None): self.url = url self._session = session @@ -116,7 +128,15 @@ class RemoteRepo(object): 'method': name, 'params': {'wire': wire, 'args': args, 'kwargs': kwargs} } - return _remote_call(self.url, payload, EXCEPTIONS_MAP, self._session) + + try: + response = _remote_call( + self.url, payload, EXCEPTIONS_MAP, self._session) + finally: + if name in self._writing_methods: + self.invalidate_vcs_cache() + + return response def _call_with_logging(self, name, *args, **kwargs): log.debug('Calling %s@%s', self.url, name)