##// END OF EJS Templates
path: forbid chaining `path://` definitions...
marmoute -
r47583:1ecf0823 default
parent child Browse files
Show More
@@ -2317,6 +2317,8 b' class path(object):'
2317 u.fragment = None
2317 u.fragment = None
2318
2318
2319 self.url = u
2319 self.url = u
2320 # the url from the config/command line before dealing with `path://`
2321 self.raw_url = u.copy()
2320 self.branch = branch
2322 self.branch = branch
2321
2323
2322 self.name = name
2324 self.name = name
@@ -2338,6 +2340,10 b' class path(object):'
2338 if self.url.scheme == b'path':
2340 if self.url.scheme == b'path':
2339 assert self.url.path is None
2341 assert self.url.path is None
2340 subpath = paths[self.url.host]
2342 subpath = paths[self.url.host]
2343 if subpath.raw_url.scheme == b'path':
2344 m = _('cannot use `%s`, "%s" is also define as a `path://`')
2345 m %= (self.rawloc, self.url.host)
2346 raise error.Abort(m)
2341 self.url = subpath.url
2347 self.url = subpath.url
2342 self.rawloc = subpath.rawloc
2348 self.rawloc = subpath.rawloc
2343 self.loc = subpath.loc
2349 self.loc = subpath.loc
@@ -3144,6 +3144,21 b' class url(object):'
3144 if v is not None:
3144 if v is not None:
3145 setattr(self, a, urlreq.unquote(v))
3145 setattr(self, a, urlreq.unquote(v))
3146
3146
3147 def copy(self):
3148 u = url(b'temporary useless value')
3149 u.path = self.path
3150 u.scheme = self.scheme
3151 u.user = self.user
3152 u.passwd = self.passwd
3153 u.host = self.host
3154 u.path = self.path
3155 u.query = self.query
3156 u.fragment = self.fragment
3157 u._localpath = self._localpath
3158 u._hostport = self._hostport
3159 u._origpath = self._origpath
3160 return u
3161
3147 @encoding.strmethod
3162 @encoding.strmethod
3148 def __repr__(self):
3163 def __repr__(self):
3149 attrs = []
3164 attrs = []
@@ -334,3 +334,39 b' test inheritance of the suboptions'
334 adding manifests
334 adding manifests
335 adding file changes
335 adding file changes
336 added 5 changesets with 0 changes to 0 files (+1 heads)
336 added 5 changesets with 0 changes to 0 files (+1 heads)
337
338 Test chaining path:// definition
339 --------------------------------
340
341 This is currently unsupported, but feel free to implement the necessary
342 dependency detection.
343
344 $ cat << EOF >> .hg/hgrc
345 > chain_path=path://other_default
346 > EOF
347
348 $ hg id
349 000000000000
350 $ hg path
351 abort: cannot use `path://other_default`, "other_default" is also define as a `path://`
352 [255]
353 $ hg pull chain_path
354 abort: cannot use `path://other_default`, "other_default" is also define as a `path://`
355 [255]
356
357 Doing an actual circle should always be an issue
358
359 $ cat << EOF >> .hg/hgrc
360 > rock=path://cissors
361 > cissors=path://paper
362 > paper=://rock
363 > EOF
364
365 $ hg id
366 000000000000
367 $ hg path
368 abort: cannot use `path://other_default`, "other_default" is also define as a `path://`
369 [255]
370 $ hg pull chain_path
371 abort: cannot use `path://other_default`, "other_default" is also define as a `path://`
372 [255]
General Comments 0
You need to be logged in to leave comments. Login now