comparison hgext/inotify/server.py @ 9116:f90bbf1ea09f

inotify: fix issue1375, add a test. The biggest problem was the data structure, which did not allow changing a file into a directory or vice versa. This problem is fixed by b55d44719b47. The walk() method also had an issue in this case: - we know 'path' as a directory. inotify server sleeps. - 'path' is deleted - 'path' is recreated as a file - the server catches up here, and see the deletion. it instantiates a scan(), which in its turn calls for walk(repo, path). - walk() then assumes that 'path' is a directory and calls os.listdir on it, which raises an OSError(errno.ENOTDIR) Catch the error, and yield the file instead of the directory contents.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 13 Jul 2009 16:49:05 +0200
parents b55d44719b47
children a87bc6e2a907
comparison
equal deleted inserted replaced
9115:b55d44719b47 9116:f90bbf1ea09f
87 elif kind in (stat.S_IFREG, stat.S_IFLNK): 87 elif kind in (stat.S_IFREG, stat.S_IFLNK):
88 files.append(name) 88 files.append(name)
89 yield fullpath, dirs, files 89 yield fullpath, dirs, files
90 90
91 except OSError, err: 91 except OSError, err:
92 if err.errno not in walk_ignored_errors: 92 if err.errno == errno.ENOTDIR:
93 # fullpath was a directory, but has since been replaced
94 # by a file.
95 yield fullpath, dirs, files
96 elif err.errno not in walk_ignored_errors:
93 raise 97 raise
94 98
95 return walkit(root, root == '') 99 return walkit(root, root == '')
96 100
97 def _explain_watch_limit(ui, repo): 101 def _explain_watch_limit(ui, repo):