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