Mercurial > hg-stable
changeset 13068:adff480db558 stable
makedirs: abort if parent == name (issue2531)
catches unknown drive letters on Windows
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 01 Dec 2010 21:15:31 +0100 |
parents | 9696954415db |
children | 6aff4f144ad3 |
files | mercurial/util.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Fri Nov 19 18:07:15 2010 +0900 +++ b/mercurial/util.py Wed Dec 01 21:15:31 2010 +0100 @@ -833,6 +833,7 @@ def makedirs(name, mode=None): """recursive directory creation with parent mode inheritance""" + parent = os.path.abspath(os.path.dirname(name)) try: os.mkdir(name) if mode is not None: @@ -841,9 +842,8 @@ except OSError, err: if err.errno == errno.EEXIST: return - if not name or err.errno != errno.ENOENT: + if not name or parent == name or err.errno != errno.ENOENT: raise - parent = os.path.abspath(os.path.dirname(name)) makedirs(parent, mode) makedirs(name, mode)