Mercurial > hg
comparison mercurial/localrepo.py @ 4829:0403b80352c9
localrepo.wwrite: use opener.symlink
This makes us fall back to regular files if symlinks are not supported.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Wed, 11 Jul 2007 17:40:41 -0300 |
parents | 8e503fa54d2d |
children | 192cd95c2ba8 2a7d30c97f89 |
comparison
equal
deleted
inserted
replaced
4828:41ad4105dde9 | 4829:0403b80352c9 |
---|---|
453 return self._filter("encode", filename, data) | 453 return self._filter("encode", filename, data) |
454 | 454 |
455 def wwrite(self, filename, data, flags): | 455 def wwrite(self, filename, data, flags): |
456 data = self._filter("decode", filename, data) | 456 data = self._filter("decode", filename, data) |
457 if "l" in flags: | 457 if "l" in flags: |
458 f = self.wjoin(filename) | 458 self.wopener.symlink(data, filename) |
459 try: | |
460 os.unlink(f) | |
461 except OSError: | |
462 pass | |
463 d = os.path.dirname(f) | |
464 if not os.path.exists(d): | |
465 os.makedirs(d) | |
466 os.symlink(data, f) | |
467 else: | 459 else: |
468 try: | 460 try: |
469 if self._link(filename): | 461 if self._link(filename): |
470 os.unlink(self.wjoin(filename)) | 462 os.unlink(self.wjoin(filename)) |
471 except OSError: | 463 except OSError: |