diff mercurial/localrepo.py @ 39024:ac0a87160012

localrepo: better error when a repo exists but we lack permissions Claiming "repository foo not found" when the repository does exist causes confusion regularly ("where is the typo?"). Differential Revision: https://phab.mercurial-scm.org/D4122
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Sat, 04 Aug 2018 21:31:46 -0400
parents 576eef1ab43d
children a915db9a5e77
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Aug 06 11:32:16 2018 -0700
+++ b/mercurial/localrepo.py	Sat Aug 04 21:31:46 2018 -0400
@@ -495,6 +495,11 @@
                         ' 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)