Show More
@@ -525,11 +525,15 b' class localrepository(repo.repository):' | |||||
525 | def wwrite(self, filename, data, flags): |
|
525 | def wwrite(self, filename, data, flags): | |
526 | data = self._filter("decode", filename, data) |
|
526 | data = self._filter("decode", filename, data) | |
527 | if "l" in flags: |
|
527 | if "l" in flags: | |
|
528 | f = self.wjoin(filename) | |||
528 | try: |
|
529 | try: | |
529 |
os.unlink( |
|
530 | os.unlink(f) | |
530 | except OSError: |
|
531 | except OSError: | |
531 | pass |
|
532 | pass | |
532 | os.symlink(data, self.wjoin(filename)) |
|
533 | d = os.path.dirname(f) | |
|
534 | if not os.path.exists(d): | |||
|
535 | os.makedirs(d) | |||
|
536 | os.symlink(data, f) | |||
533 | else: |
|
537 | else: | |
534 | try: |
|
538 | try: | |
535 | if self._link(filename): |
|
539 | if self._link(filename): |
@@ -55,3 +55,18 b" echo '# try symlink outside repo to file" | |||||
55 | ln -s x/f ../z |
|
55 | ln -s x/f ../z | |
56 | # this should fail |
|
56 | # this should fail | |
57 | hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : |
|
57 | hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : | |
|
58 | ||||
|
59 | cd .. ; rm -r test | |||
|
60 | hg init test; cd test; | |||
|
61 | ||||
|
62 | echo '# try cloning symlink in a subdir' | |||
|
63 | echo '1. commit a symlink' | |||
|
64 | mkdir -p a/b/c | |||
|
65 | cd a/b/c | |||
|
66 | ln -s /path/to/symlink/source demo | |||
|
67 | cd ../../.. | |||
|
68 | hg stat | |||
|
69 | hg commit -A -m 'add symlink in a/b/c subdir' | |||
|
70 | echo '2. clone it' | |||
|
71 | cd .. | |||
|
72 | hg clone test testclone |
@@ -14,3 +14,9 b' a.c: unsupported file type (type is fifo' | |||||
14 | A f |
|
14 | A f | |
15 | # try symlink outside repo to file inside |
|
15 | # try symlink outside repo to file inside | |
16 | abort: ../z not under root |
|
16 | abort: ../z not under root | |
|
17 | # try cloning symlink in a subdir | |||
|
18 | 1. commit a symlink | |||
|
19 | ? a/b/c/demo | |||
|
20 | adding a/b/c/demo | |||
|
21 | 2. clone it | |||
|
22 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
General Comments 0
You need to be logged in to leave comments.
Login now