mercurial/util.py
changeset 31541 bd9daafbf87c
parent 31540 6d5b77abf306
child 31567 4ebecf331d7d
equal deleted inserted replaced
31540:6d5b77abf306 31541:bd9daafbf87c
  1604         else:
  1604         else:
  1605             self.close()
  1605             self.close()
  1606 
  1606 
  1607 def unlinkpath(f, ignoremissing=False):
  1607 def unlinkpath(f, ignoremissing=False):
  1608     """unlink and remove the directory if it is empty"""
  1608     """unlink and remove the directory if it is empty"""
  1609     try:
  1609     if ignoremissing:
       
  1610         tryunlink(f)
       
  1611     else:
  1610         unlink(f)
  1612         unlink(f)
  1611     except OSError as e:
       
  1612         if not (ignoremissing and e.errno == errno.ENOENT):
       
  1613             raise
       
  1614     # try removing directories that might now be empty
  1613     # try removing directories that might now be empty
  1615     try:
  1614     try:
  1616         removedirs(os.path.dirname(f))
  1615         removedirs(os.path.dirname(f))
  1617     except OSError:
  1616     except OSError:
  1618         pass
  1617         pass