def _newest_file(dirpath):
"""Find the last modified RCS file in a directory"""
newest_file = None
newest_time = 0
### FIXME: This sucker is leaking unauthorized paths! ###
for subfile in os.listdir(dirpath):
### filter CVS locks? stale NFS handles?
if subfile[-2:] != ',v':
continue
path = os.path.join(dirpath, subfile)
info = os.stat(path)
if not stat.S_ISREG(info[stat.ST_MODE]):
continue
if info[stat.ST_MTIME] > newest_time:
kind, verboten = _check_path(path)
if kind == vclib.FILE and not verboten:
newest_file = subfile[:-2]
newest_time = info[stat.ST_MTIME]
return newest_file
评论列表
文章目录