##// END OF EJS Templates
paths: move path validation logic to its own function...
Durham Goode -
r26076:cebf7e48 default
parent child Browse files
Show More
@@ -1068,11 +1068,17 b' class path(object):'
1068
1068
1069 # When given a raw location but not a symbolic name, validate the
1069 # When given a raw location but not a symbolic name, validate the
1070 # location is valid.
1070 # location is valid.
1071 if (not name and not u.scheme
1071 if not name and not u.scheme and not self._isvalidlocalpath(self.loc):
1072 and not os.path.isdir(os.path.join(str(u), '.hg'))):
1073 raise ValueError('location is not a URL or path to a local '
1072 raise ValueError('location is not a URL or path to a local '
1074 'repo: %s' % rawloc)
1073 'repo: %s' % rawloc)
1075
1074
1075 def _isvalidlocalpath(self, path):
1076 """Returns True if the given path is a potentially valid repository.
1077 This is its own function so that extensions can change the definition of
1078 'valid' in this case (like when pulling from a git repo into a hg
1079 one)."""
1080 return os.path.isdir(os.path.join(path, '.hg'))
1081
1076 @property
1082 @property
1077 def pushloc(self):
1083 def pushloc(self):
1078 return self._pushloc or self.loc
1084 return self._pushloc or self.loc
General Comments 0
You need to be logged in to leave comments. Login now