hgext/remotefilelog/remotefilelogserver.py
changeset 49305 53e9422a9b45
parent 48946 642e31cb55f0
child 50471 521fec115dad
equal deleted inserted replaced
49304:48f1b314056b 49305:53e9422a9b45
     3 # Copyright 2013 Facebook, Inc.
     3 # Copyright 2013 Facebook, Inc.
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 import errno
       
     9 import os
     8 import os
    10 import stat
     9 import stat
    11 import time
    10 import time
    12 import zlib
    11 import zlib
    13 
    12 
   253         try:
   252         try:
   254             dirname = os.path.dirname(filecachepath)
   253             dirname = os.path.dirname(filecachepath)
   255             if not os.path.exists(dirname):
   254             if not os.path.exists(dirname):
   256                 try:
   255                 try:
   257                     os.makedirs(dirname)
   256                     os.makedirs(dirname)
   258                 except OSError as ex:
   257                 except FileExistsError:
   259                     if ex.errno != errno.EEXIST:
   258                     pass
   260                         raise
       
   261 
   259 
   262             f = None
   260             f = None
   263             try:
   261             try:
   264                 f = util.atomictempfile(filecachepath, b"wb")
   262                 f = util.atomictempfile(filecachepath, b"wb")
   265                 f.write(text)
   263                 f.write(text)