diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -495,6 +495,11 @@ class localrepository(object): ' dummy changelog to prevent using the old repo layout' ) else: + try: + self.vfs.stat() + except OSError as inst: + if inst.errno != errno.ENOENT: + raise raise error.RepoError(_("repository %s not found") % path) elif create: raise error.RepoError(_("repository %s already exists") % path) diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -642,7 +642,7 @@ Inaccessible source $ mkdir a $ chmod 000 a $ hg clone a b - abort: repository a not found! + abort: Permission denied: '$TESTTMP/fail/a/.hg' [255] Inaccessible destination @@ -665,7 +665,7 @@ Source of wrong type $ mkfifo a $ hg clone a b - abort: repository a not found! + abort: $ENOTDIR$: '$TESTTMP/fail/a/.hg' [255] $ rm a