Show More
@@ -219,9 +219,16 def checklink(path): | |||||
219 | # mktemp is not racy because symlink creation will fail if the |
|
219 | # mktemp is not racy because symlink creation will fail if the | |
220 | # file already exists |
|
220 | # file already exists | |
221 | while True: |
|
221 | while True: | |
222 | name = tempfile.mktemp(dir=path, prefix='hg-checklink-') |
|
222 | cachedir = os.path.join(path, '.hg', 'cache') | |
|
223 | if os.path.isdir(cachedir): | |||
|
224 | checkdir = cachedir | |||
|
225 | else: | |||
|
226 | checkdir = path | |||
|
227 | cachedir = None | |||
|
228 | name = tempfile.mktemp(dir=checkdir, prefix='checklink-') | |||
223 | try: |
|
229 | try: | |
224 |
fd = tempfile.NamedTemporaryFile(dir= |
|
230 | fd = tempfile.NamedTemporaryFile(dir=checkdir, | |
|
231 | prefix='hg-checklink-') | |||
225 | try: |
|
232 | try: | |
226 | os.symlink(os.path.basename(fd.name), name) |
|
233 | os.symlink(os.path.basename(fd.name), name) | |
227 | os.unlink(name) |
|
234 | os.unlink(name) |
General Comments 0
You need to be logged in to leave comments.
Login now