Show More
@@ -1021,6 +1021,9 b' class localrepository(object):' | |||||
1021 | reporef().hook('txnabort', throw=False, txnname=desc, |
|
1021 | reporef().hook('txnabort', throw=False, txnname=desc, | |
1022 | **tr2.hookargs) |
|
1022 | **tr2.hookargs) | |
1023 | tr.addabort('txnabort-hook', txnaborthook) |
|
1023 | tr.addabort('txnabort-hook', txnaborthook) | |
|
1024 | # avoid eager cache invalidation. in-memory data should be identical | |||
|
1025 | # to stored data if transaction has no error. | |||
|
1026 | tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats) | |||
1024 | self._transref = weakref.ref(tr) |
|
1027 | self._transref = weakref.ref(tr) | |
1025 | return tr |
|
1028 | return tr | |
1026 |
|
1029 | |||
@@ -1198,7 +1201,7 b' class localrepository(object):' | |||||
1198 | self.invalidate() |
|
1201 | self.invalidate() | |
1199 | self.invalidatedirstate() |
|
1202 | self.invalidatedirstate() | |
1200 |
|
1203 | |||
1201 | def _refreshfilecachestats(self): |
|
1204 | def _refreshfilecachestats(self, tr): | |
1202 | """Reload stats of cached files so that they are flagged as valid""" |
|
1205 | """Reload stats of cached files so that they are flagged as valid""" | |
1203 | for k, ce in self._filecache.items(): |
|
1206 | for k, ce in self._filecache.items(): | |
1204 | if k == 'dirstate' or k not in self.__dict__: |
|
1207 | if k == 'dirstate' or k not in self.__dict__: | |
@@ -1247,7 +1250,7 b' class localrepository(object):' | |||||
1247 | l.lock() |
|
1250 | l.lock() | |
1248 | return l |
|
1251 | return l | |
1249 |
|
1252 | |||
1250 |
l = self._lock(self.svfs, "lock", wait, |
|
1253 | l = self._lock(self.svfs, "lock", wait, None, | |
1251 | self.invalidate, _('repository %s') % self.origroot) |
|
1254 | self.invalidate, _('repository %s') % self.origroot) | |
1252 | self._lockref = weakref.ref(l) |
|
1255 | self._lockref = weakref.ref(l) | |
1253 | return l |
|
1256 | return l |
@@ -415,6 +415,30 b' check that local configs for the cached ' | |||||
415 | *** runcommand branches |
|
415 | *** runcommand branches | |
416 | default 1:731265503d86 |
|
416 | default 1:731265503d86 | |
417 |
|
417 | |||
|
418 | in-memory cache must be reloaded if transaction is aborted. otherwise | |||
|
419 | changelog and manifest would have invalid node: | |||
|
420 | ||||
|
421 | $ echo a >> a | |||
|
422 | >>> from hgclient import readchannel, runcommand, check | |||
|
423 | >>> @check | |||
|
424 | ... def txabort(server): | |||
|
425 | ... readchannel(server) | |||
|
426 | ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false', | |||
|
427 | ... '-mfoo']) | |||
|
428 | ... runcommand(server, ['verify']) | |||
|
429 | *** runcommand commit --config hooks.pretxncommit=false -mfoo | |||
|
430 | transaction abort! | |||
|
431 | rollback completed | |||
|
432 | abort: pretxncommit hook exited with status 1 | |||
|
433 | [255] | |||
|
434 | *** runcommand verify | |||
|
435 | checking changesets | |||
|
436 | checking manifests | |||
|
437 | crosschecking files in changesets and manifests | |||
|
438 | checking files | |||
|
439 | 1 files, 2 changesets, 2 total revisions | |||
|
440 | $ hg revert --no-backup -aq | |||
|
441 | ||||
418 | $ cat >> .hg/hgrc << EOF |
|
442 | $ cat >> .hg/hgrc << EOF | |
419 | > [experimental] |
|
443 | > [experimental] | |
420 | > evolution=createmarkers |
|
444 | > evolution=createmarkers |
General Comments 0
You need to be logged in to leave comments.
Login now