Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 13279:eed22340b7aa
opener: check exception for ENOENT
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 11 Jan 2011 14:10:16 +0100 |
parents | 6bf39d88c857 |
children | c01eea6c455b |
comparison
equal
deleted
inserted
replaced
13278:e9a52ed28157 | 13279:eed22340b7aa |
---|---|
917 # nlinks() may behave differently for files on Windows | 917 # nlinks() may behave differently for files on Windows |
918 # shares if the file is open. | 918 # shares if the file is open. |
919 fd = open(f) | 919 fd = open(f) |
920 nlink = nlinks(f) | 920 nlink = nlinks(f) |
921 fd.close() | 921 fd.close() |
922 except (OSError, IOError): | 922 except (OSError, IOError), e: |
923 if e.errno != errno.ENOENT: | |
924 raise | |
923 nlink = 0 | 925 nlink = 0 |
924 if not os.path.isdir(dirname): | 926 if not os.path.isdir(dirname): |
925 makedirs(dirname, self.createmode) | 927 makedirs(dirname, self.createmode) |
926 if nlink > 0: | 928 if nlink > 0: |
927 if self._trustnlink is None: | 929 if self._trustnlink is None: |