Mercurial > hg
comparison mercurial/scmutil.py @ 24628:a0b47885a1c5
vfs: make it possible to pass multiple path elements to join
os.path.join(), localrepo.join() and localrepo.wjoin() allow passing multiple
path elements; vfs.join() should be as convenient.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 04 Apr 2015 17:19:16 -0400 |
parents | 56fff44cce98 |
children | 21e1ece30f8c |
comparison
equal
deleted
inserted
replaced
24627:f33236c9b025 | 24628:a0b47885a1c5 |
---|---|
443 raise OSError(err.errno, _('could not symlink to %r: %s') % | 443 raise OSError(err.errno, _('could not symlink to %r: %s') % |
444 (src, err.strerror), linkname) | 444 (src, err.strerror), linkname) |
445 else: | 445 else: |
446 self.write(dst, src) | 446 self.write(dst, src) |
447 | 447 |
448 def join(self, path): | 448 def join(self, path, *insidef): |
449 if path: | 449 if path: |
450 return os.path.join(self.base, path) | 450 return os.path.join(self.base, path, *insidef) |
451 else: | 451 else: |
452 return self.base | 452 return self.base |
453 | 453 |
454 opener = vfs | 454 opener = vfs |
455 | 455 |
473 self._filter = filter | 473 self._filter = filter |
474 | 474 |
475 def __call__(self, path, *args, **kwargs): | 475 def __call__(self, path, *args, **kwargs): |
476 return self.vfs(self._filter(path), *args, **kwargs) | 476 return self.vfs(self._filter(path), *args, **kwargs) |
477 | 477 |
478 def join(self, path): | 478 def join(self, path, *insidef): |
479 if path: | 479 if path: |
480 return self.vfs.join(self._filter(path)) | 480 return self.vfs.join(self._filter(self.vfs.reljoin(path, *insidef))) |
481 else: | 481 else: |
482 return self.vfs.join(path) | 482 return self.vfs.join(path) |
483 | 483 |
484 filteropener = filtervfs | 484 filteropener = filtervfs |
485 | 485 |