mercurial/ui.py
changeset 26076 cebf7e48365e
parent 26064 1b1ab6ff58c4
child 26189 663fbc336e22
--- a/mercurial/ui.py	Fri Aug 21 14:33:51 2015 -0400
+++ b/mercurial/ui.py	Mon Aug 24 19:33:36 2015 -0700
@@ -1068,11 +1068,17 @@
 
         # When given a raw location but not a symbolic name, validate the
         # location is valid.
-        if (not name and not u.scheme
-            and not os.path.isdir(os.path.join(str(u), '.hg'))):
+        if not name and not u.scheme and not self._isvalidlocalpath(self.loc):
             raise ValueError('location is not a URL or path to a local '
                              'repo: %s' % rawloc)
 
+    def _isvalidlocalpath(self, path):
+        """Returns True if the given path is a potentially valid repository.
+        This is its own function so that extensions can change the definition of
+        'valid' in this case (like when pulling from a git repo into a hg
+        one)."""
+        return os.path.isdir(os.path.join(path, '.hg'))
+
     @property
     def pushloc(self):
         return self._pushloc or self.loc