Mercurial > hg > mercurial-source
changeset 40633:b504ff813c4f
localrepo: validate directories before creating any
There is no meaningful change in behavior because wdir would
already exist in the case where we raised RepoError. But I think
the code is easier to read if we do all validation first then
take actions with side-effects.
Differential Revision: https://phab.mercurial-scm.org/D4706
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 19 Sep 2018 16:51:57 -0700 (2018-09-19) |
parents | d3e761f9ac0a |
children | 4ece3cdfd907 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2798,13 +2798,14 @@ requirements = newreporequirements(ui, createopts=createopts) wdirvfs = vfsmod.vfs(path, expandpath=True, realpath=True) - if not wdirvfs.exists(): - wdirvfs.makedirs() hgvfs = vfsmod.vfs(wdirvfs.join(b'.hg')) if hgvfs.exists(): raise error.RepoError(_('repository %s already exists') % path) + if not wdirvfs.exists(): + wdirvfs.makedirs() + hgvfs.makedir(notindexed=True) if b'store' in requirements: