Mercurial > hg-stable
changeset 40209:6b1a8c396b05
fsmonitor: use vfs instead of opener (issue5938)
"opener" of localrepository object was dropped at Mercurial 4.3 (or
a7e210167c28). "vfs" should be used instead.
wlock is required to write into a file under .hg directory.
For efficiency, we should change _cmpsets() from:
1. acquire wlock
2. open log file under .hg directory with write mode
3. compare between result of watchman and Mercurial's dirstate logic
4. write out error info into a file, if error is detected
5. release wlock
to:
1. compare between result of watchman and Mercurial's dirstate logic
2. acquire wlock, if error is detected
3. open and write error info into a file
4. release wlock
But this is another issue.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 12 Oct 2018 16:45:46 +0900 |
parents | b7ba1cfba174 |
children | 8f192f2c4a1e |
files | hgext/fsmonitor/__init__.py |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py Fri Oct 12 16:07:08 2018 +0900 +++ b/hgext/fsmonitor/__init__.py Fri Oct 12 16:45:46 2018 +0900 @@ -460,7 +460,7 @@ f = open(fn, 'wb') else: fn = 'fsmonitorfail.log' - f = self.opener(fn, 'wb') + f = self.vfs.open(fn, 'wb') except (IOError, OSError): self.ui.warn(_('warning: unable to write to %s\n') % fn) return @@ -564,8 +564,10 @@ self.ui.fout, self.ui.ferr = fout, ferr # clean isn't tested since it's set to True above - _cmpsets([modified, added, removed, deleted, unknown, ignored, clean], - rv2) + with self.wlock(): + _cmpsets( + [modified, added, removed, deleted, unknown, ignored, clean], + rv2) modified, added, removed, deleted, unknown, ignored, clean = rv2 return scmutil.status(