Show More
@@ -85,7 +85,9 b' class BranchMapCache:' | |||||
85 | bcache._filtername, |
|
85 | bcache._filtername, | |
86 | repo.filtername, |
|
86 | repo.filtername, | |
87 | ) |
|
87 | ) | |
88 | bcache.sync_disk(repo) |
|
88 | tr = repo.currenttransaction() | |
|
89 | if getattr(tr, 'finalized', True): | |||
|
90 | bcache.sync_disk(repo) | |||
89 |
|
91 | |||
90 | def updatecache(self, repo): |
|
92 | def updatecache(self, repo): | |
91 | """Update the cache for the given filtered view on a repository""" |
|
93 | """Update the cache for the given filtered view on a repository""" | |
@@ -603,12 +605,11 b' class branchcache(_BaseBranchCache):' | |||||
603 | repo.filtername, |
|
605 | repo.filtername, | |
604 | ) |
|
606 | ) | |
605 | assert self._state == STATE_DIRTY, self._state |
|
607 | assert self._state == STATE_DIRTY, self._state | |
|
608 | # This method should not be called during an open transaction | |||
606 | tr = repo.currenttransaction() |
|
609 | tr = repo.currenttransaction() | |
607 | if not getattr(tr, 'finalized', True): |
|
610 | if not getattr(tr, 'finalized', True): | |
608 | # Avoid premature writing. |
|
611 | msg = "writing branchcache in the middle of a transaction" | |
609 | # |
|
612 | raise error.ProgrammingError(msg) | |
610 | # (The cache warming setup by localrepo will update the file later.) |
|
|||
611 | return |
|
|||
612 | try: |
|
613 | try: | |
613 | filename = self._filename(repo) |
|
614 | filename = self._filename(repo) | |
614 | with repo.cachevfs(filename, b"w", atomictemp=True) as f: |
|
615 | with repo.cachevfs(filename, b"w", atomictemp=True) as f: | |
@@ -732,7 +733,12 b' class branchcache(_BaseBranchCache):' | |||||
732 | repo, self.tiprev, needobsolete=True |
|
733 | repo, self.tiprev, needobsolete=True | |
733 | ) |
|
734 | ) | |
734 | self._state = STATE_DIRTY |
|
735 | self._state = STATE_DIRTY | |
735 | self.write(repo) |
|
736 | tr = repo.currenttransaction() | |
|
737 | if getattr(tr, 'finalized', True): | |||
|
738 | # Avoid premature writing. | |||
|
739 | # | |||
|
740 | # (The cache warming setup by localrepo will update the file later.) | |||
|
741 | self.write(repo) | |||
736 |
|
742 | |||
737 |
|
743 | |||
738 | class remotebranchcache(_BaseBranchCache): |
|
744 | class remotebranchcache(_BaseBranchCache): |
General Comments 0
You need to be logged in to leave comments.
Login now