Patchwork [06,of,10] vfs: add "notindexed" argument to invoke "ensuredir" with it in write mode

login
register
mail settings
Submitter Katsunori FUJIWARA
Date May 28, 2014, 3 p.m.
Message ID <e8bcf7420213eb28e5f1.1401289218@juju>
Download mbox | patch
Permalink /patch/4887/
State Superseded
Commit 46265d0f0c7ba1c492985a42ef60313193d1eb17
Headers show

Comments

Katsunori FUJIWARA - May 28, 2014, 3 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1401288802 -32400
#      Wed May 28 23:53:22 2014 +0900
# Node ID e8bcf7420213eb28e5f1217fbed7fd1c69200fc5
# Parent  ab38c2a1b9b3e8b80657dde6ed1f7897874d144c
vfs: add "notindexed" argument to invoke "ensuredir" with it in write mode
Pierre-Yves David - June 6, 2014, 1:07 a.m.
On 05/28/2014 08:00 AM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1401288802 -32400
> #      Wed May 28 23:53:22 2014 +0900
> # Node ID e8bcf7420213eb28e5f1217fbed7fd1c69200fc5
> # Parent  ab38c2a1b9b3e8b80657dde6ed1f7897874d144c
> vfs: add "notindexed" argument to invoke "ensuredir" with it in write mode

I'll want you to update the documentation about what ``notindexed`` is 
about.

In that case that also mean adding a documentation to the thing in the 
first place.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -144,9 +144,10 @@  class abstractvfs(object):
                 raise
         return []
 
-    def open(self, path, mode="r", text=False, atomictemp=False):
+    def open(self, path, mode="r", text=False, atomictemp=False,
+             notindexed=False):
         self.open = self.__call__
-        return self.__call__(path, mode, text, atomictemp)
+        return self.__call__(path, mode, text, atomictemp, notindexed)
 
     def read(self, path):
         fp = self(path, 'rb')
@@ -286,7 +287,8 @@  class vfs(abstractvfs):
             return
         os.chmod(name, self.createmode & 0666)
 
-    def __call__(self, path, mode="r", text=False, atomictemp=False):
+    def __call__(self, path, mode="r", text=False, atomictemp=False,
+                 notindexed=False):
         if self._audit:
             r = util.checkosfilename(path)
             if r:
@@ -304,7 +306,7 @@  class vfs(abstractvfs):
             # to a directory. Let the posixfile() call below raise IOError.
             if basename:
                 if atomictemp:
-                    util.ensuredirs(dirname, self.createmode)
+                    util.ensuredirs(dirname, self.createmode, notindexed)
                     return util.atomictempfile(f, mode, self.createmode)
                 try:
                     if 'w' in mode:
@@ -322,7 +324,7 @@  class vfs(abstractvfs):
                     if e.errno != errno.ENOENT:
                         raise
                     nlink = 0
-                    util.ensuredirs(dirname, self.createmode)
+                    util.ensuredirs(dirname, self.createmode, notindexed)
                 if nlink > 0:
                     if self._trustnlink is None:
                         self._trustnlink = nlink > 1 or util.checknlink(f)
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -910,15 +910,15 @@  def makedirs(name, mode=None, notindexed
     if mode is not None:
         os.chmod(name, mode)
 
-def ensuredirs(name, mode=None):
+def ensuredirs(name, mode=None, notindexed=False):
     """race-safe recursive directory creation"""
     if os.path.isdir(name):
         return
     parent = os.path.dirname(os.path.abspath(name))
     if parent != name:
-        ensuredirs(parent, mode)
-    try:
-        os.mkdir(name)
+        ensuredirs(parent, mode, notindexed)
+    try:
+        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