Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGe787d97e90ad: py3: fix test-dirstate-race.t
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
pulkit |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | contrib/python3-whitelist (1 line) | |||
M | mercurial/localrepo.py (4 lines) | |||
M | tests/test-dirstate-race.t (2 lines) |
Commit | Local | Parents | Author | Summary | Date |
---|---|---|---|---|---|
45d535cbb89d | 40342 | 2dc84fe527ae | Mark Thomas | py3: fix test-dirstate-race.t | Oct 14 2018, 10:02 AM |
test-diff-subdir.t | test-diff-subdir.t | ||||
test-diff-unified.t | test-diff-unified.t | ||||
test-diff-upgrade.t | test-diff-upgrade.t | ||||
test-diffdir.t | test-diffdir.t | ||||
test-diffstat.t | test-diffstat.t | ||||
test-directaccess.t | test-directaccess.t | ||||
test-dirstate-backup.t | test-dirstate-backup.t | ||||
test-dirstate-nonnormalset.t | test-dirstate-nonnormalset.t | ||||
test-dirstate-race.t | |||||
test-dirstate.t | test-dirstate.t | ||||
test-dispatch.py | test-dispatch.py | ||||
test-doctest.py | test-doctest.py | ||||
test-double-merge.t | test-double-merge.t | ||||
test-drawdag.t | test-drawdag.t | ||||
test-duplicateoptions.py | test-duplicateoptions.py | ||||
test-editor-filename.t | test-editor-filename.t | ||||
test-empty-dir.t | test-empty-dir.t |
'''Invalidates the dirstate, causing the next call to dirstate | '''Invalidates the dirstate, causing the next call to dirstate | ||||
to check if it was modified since the last time it was read, | to check if it was modified since the last time it was read, | ||||
rereading it if it has. | rereading it if it has. | ||||
This is different to dirstate.invalidate() that it doesn't always | This is different to dirstate.invalidate() that it doesn't always | ||||
rereads the dirstate. Use dirstate.invalidate() if you want to | rereads the dirstate. Use dirstate.invalidate() if you want to | ||||
explicitly read the dirstate again (i.e. restoring it to a previous | explicitly read the dirstate again (i.e. restoring it to a previous | ||||
known good state).''' | known good state).''' | ||||
if hasunfilteredcache(self, 'dirstate'): | if hasunfilteredcache(self, r'dirstate'): | ||||
for k in self.dirstate._filecache: | for k in self.dirstate._filecache: | ||||
try: | try: | ||||
delattr(self.dirstate, k) | delattr(self.dirstate, k) | ||||
except AttributeError: | except AttributeError: | ||||
pass | pass | ||||
delattr(self.unfiltered(), 'dirstate') | delattr(self.unfiltered(), r'dirstate') | ||||
def invalidate(self, clearfilecache=False): | def invalidate(self, clearfilecache=False): | ||||
'''Invalidates both store and non-store parts other than dirstate | '''Invalidates both store and non-store parts other than dirstate | ||||
If a transaction is running, invalidation of store is omitted, | If a transaction is running, invalidation of store is omitted, | ||||
because discarding in-memory changes might cause inconsistency | because discarding in-memory changes might cause inconsistency | ||||
(e.g. incomplete fncache causes unintentional failure, but | (e.g. incomplete fncache causes unintentional failure, but | ||||
redundant one doesn't). | redundant one doesn't). |
> from mercurial import ( | > from mercurial import ( | ||||
> context, | > context, | ||||
> extensions, | > extensions, | ||||
> ) | > ) | ||||
> def extsetup(): | > def extsetup(): | ||||
> extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup) | > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup) | ||||
> def overridechecklookup(orig, self, files): | > def overridechecklookup(orig, self, files): | ||||
> # make an update that changes the dirstate from underneath | > # make an update that changes the dirstate from underneath | ||||
> self._repo.ui.system(r"sh '$TESTTMP/dirstaterace.sh'", | > self._repo.ui.system(br"sh '$TESTTMP/dirstaterace.sh'", | ||||
> cwd=self._repo.root) | > cwd=self._repo.root) | ||||
> return orig(self, files) | > return orig(self, files) | ||||
> EOF | > EOF | ||||
$ hg debugrebuilddirstate | $ hg debugrebuilddirstate | ||||
$ hg debugdirstate | $ hg debugdirstate | ||||
n 0 -1 unset a | n 0 -1 unset a | ||||
n 0 -1 unset b | n 0 -1 unset b |