Mercurial > hg
changeset 15058:81f33be0ea79
util: postpone and reorder parent calculation in makedirs
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Thu, 25 Aug 2011 11:03:16 +0200 |
parents | 774da7121fc9 |
children | 86380f24e697 |
files | mercurial/util.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Thu Aug 25 20:21:04 2011 -0400 +++ b/mercurial/util.py Thu Aug 25 11:03:16 2011 +0200 @@ -779,13 +779,15 @@ def makedirs(name, mode=None): """recursive directory creation with parent mode inheritance""" - parent = os.path.abspath(os.path.dirname(name)) try: os.mkdir(name) except OSError, err: if err.errno == errno.EEXIST: return - if not name or parent == name or err.errno != errno.ENOENT: + if err.errno != errno.ENOENT or not name: + raise + parent = os.path.dirname(os.path.abspath(name)) + if parent == name: raise makedirs(parent, mode) os.mkdir(name)