##// END OF EJS Templates
vcs: Move vcsserver cache invalidation to mercurial backend....
Martin Bornhold -
r407:243d422c default
parent child Browse files
Show More
@@ -175,6 +175,7 b' class MercurialRepository(BaseRepository'
175
175
176 self._remote.tag(
176 self._remote.tag(
177 name, commit.raw_id, message, local, user, date, tz)
177 name, commit.raw_id, message, local, user, date, tz)
178 self._remote.invalidate_vcs_cache()
178
179
179 # Reinitialize tags
180 # Reinitialize tags
180 self.tags = self._get_tags()
181 self.tags = self._get_tags()
@@ -202,6 +203,7 b' class MercurialRepository(BaseRepository'
202 date, tz = date_to_timestamp_plus_offset(date)
203 date, tz = date_to_timestamp_plus_offset(date)
203
204
204 self._remote.tag(name, nullid, message, local, user, date, tz)
205 self._remote.tag(name, nullid, message, local, user, date, tz)
206 self._remote.invalidate_vcs_cache()
205 self.tags = self._get_tags()
207 self.tags = self._get_tags()
206
208
207 @LazyProperty
209 @LazyProperty
@@ -261,6 +263,7 b' class MercurialRepository(BaseRepository'
261 def strip(self, commit_id, branch=None):
263 def strip(self, commit_id, branch=None):
262 self._remote.strip(commit_id, update=False, backup="none")
264 self._remote.strip(commit_id, update=False, backup="none")
263
265
266 self._remote.invalidate_vcs_cache()
264 self.commit_ids = self._get_all_commit_ids()
267 self.commit_ids = self._get_all_commit_ids()
265 self._rebuild_cache(self.commit_ids)
268 self._rebuild_cache(self.commit_ids)
266
269
@@ -530,6 +533,7 b' class MercurialRepository(BaseRepository'
530 """
533 """
531 url = self._get_url(url)
534 url = self._get_url(url)
532 self._remote.pull(url, commit_ids=commit_ids)
535 self._remote.pull(url, commit_ids=commit_ids)
536 self._remote.invalidate_vcs_cache()
533
537
534 def _local_clone(self, clone_path):
538 def _local_clone(self, clone_path):
535 """
539 """
@@ -603,6 +607,7 b' class MercurialRepository(BaseRepository'
603 self.bookmark(bookmark_name, revision=source_ref.commit_id)
607 self.bookmark(bookmark_name, revision=source_ref.commit_id)
604 self._remote.rebase(
608 self._remote.rebase(
605 source=source_ref.commit_id, dest=target_ref.commit_id)
609 source=source_ref.commit_id, dest=target_ref.commit_id)
610 self._remote.invalidate_vcs_cache()
606 self._update(bookmark_name)
611 self._update(bookmark_name)
607 return self._identify(), True
612 return self._identify(), True
608 except RepositoryError:
613 except RepositoryError:
@@ -611,15 +616,19 b' class MercurialRepository(BaseRepository'
611 log.exception('Error while rebasing shadow repo during merge.')
616 log.exception('Error while rebasing shadow repo during merge.')
612
617
613 # Cleanup any rebase leftovers
618 # Cleanup any rebase leftovers
619 self._remote.invalidate_vcs_cache()
614 self._remote.rebase(abort=True)
620 self._remote.rebase(abort=True)
621 self._remote.invalidate_vcs_cache()
615 self._remote.update(clean=True)
622 self._remote.update(clean=True)
616 raise
623 raise
617 else:
624 else:
618 try:
625 try:
619 self._remote.merge(source_ref.commit_id)
626 self._remote.merge(source_ref.commit_id)
627 self._remote.invalidate_vcs_cache()
620 self._remote.commit(
628 self._remote.commit(
621 message=safe_str(merge_message),
629 message=safe_str(merge_message),
622 username=safe_str('%s <%s>' % (user_name, user_email)))
630 username=safe_str('%s <%s>' % (user_name, user_email)))
631 self._remote.invalidate_vcs_cache()
623 return self._identify(), True
632 return self._identify(), True
624 except RepositoryError:
633 except RepositoryError:
625 # Cleanup any merge leftovers
634 # Cleanup any merge leftovers
@@ -771,11 +780,13 b' class MercurialRepository(BaseRepository'
771
780
772 options = {option_name: [ref]}
781 options = {option_name: [ref]}
773 self._remote.pull_cmd(repository_path, hooks=False, **options)
782 self._remote.pull_cmd(repository_path, hooks=False, **options)
783 self._remote.invalidate_vcs_cache()
774
784
775 def bookmark(self, bookmark, revision=None):
785 def bookmark(self, bookmark, revision=None):
776 if isinstance(bookmark, unicode):
786 if isinstance(bookmark, unicode):
777 bookmark = safe_str(bookmark)
787 bookmark = safe_str(bookmark)
778 self._remote.bookmark(bookmark, revision=revision)
788 self._remote.bookmark(bookmark, revision=revision)
789 self._remote.invalidate_vcs_cache()
779
790
780
791
781 class MercurialIndexBasedCollectionGenerator(CollectionGenerator):
792 class MercurialIndexBasedCollectionGenerator(CollectionGenerator):
@@ -84,18 +84,6 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
99 def __init__(self, path, config, url, session, with_wire=None):
87 def __init__(self, path, config, url, session, with_wire=None):
100 self.url = url
88 self.url = url
101 self._session = session
89 self._session = session
@@ -128,15 +116,7 b' class RemoteRepo(object):'
128 'method': name,
116 'method': name,
129 'params': {'wire': wire, 'args': args, 'kwargs': kwargs}
117 'params': {'wire': wire, 'args': args, 'kwargs': kwargs}
130 }
118 }
131
119 return _remote_call(self.url, payload, EXCEPTIONS_MAP, self._session)
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
140
120
141 def _call_with_logging(self, name, *args, **kwargs):
121 def _call_with_logging(self, name, *args, **kwargs):
142 log.debug('Calling %s@%s', self.url, name)
122 log.debug('Calling %s@%s', self.url, name)
General Comments 0
You need to be logged in to leave comments. Login now