Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 23370:46265d0f0c7b
vfs: add "notindexed" argument to invoke "ensuredir" with it in write mode
This patch uses "False" as default value of "notindexed" argument,
even though "vfs.makedir()" uses "True" for it, because "os.mkdir()"
doesn't set "_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED" attribute to newly
created directories.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 19 Nov 2014 18:35:14 +0900 |
parents | 76302f5ceba4 |
children | b25f07cb5399 |
line wrap: on
line diff
--- a/mercurial/util.py Wed Nov 19 18:35:14 2014 +0900 +++ b/mercurial/util.py Wed Nov 19 18:35:14 2014 +0900 @@ -1088,15 +1088,20 @@ if mode is not None: os.chmod(name, mode) -def ensuredirs(name, mode=None): - """race-safe recursive directory creation""" +def ensuredirs(name, mode=None, notindexed=False): + """race-safe recursive directory creation + + Newly created directories are marked as "not to be indexed by + the content indexing service", if ``notindexed`` is specified + for "write" mode access. + """ if os.path.isdir(name): return parent = os.path.dirname(os.path.abspath(name)) if parent != name: - ensuredirs(parent, mode) + ensuredirs(parent, mode, notindexed) try: - os.mkdir(name) + makedir(name, notindexed) except OSError, err: if err.errno == errno.EEXIST and os.path.isdir(name): # someone else seems to have won a directory creation race