##// END OF EJS Templates
posix: give the cached symlink a real target...
Martijn Pieters -
r30555:6a672c3b default
parent child Browse files
Show More
@@ -231,10 +231,18 b' def checklink(path):'
231 231 cachedir = None
232 232 name = tempfile.mktemp(dir=checkdir, prefix='checklink-')
233 233 try:
234 fd = tempfile.NamedTemporaryFile(dir=checkdir,
235 prefix='hg-checklink-')
234 fd = None
235 if cachedir is None:
236 fd = tempfile.NamedTemporaryFile(dir=checkdir,
237 prefix='hg-checklink-')
238 target = os.path.basename(fd.name)
239 else:
240 # create a fixed file to link to; doesn't matter if it
241 # already exists.
242 target = 'checklink-target'
243 open(os.path.join(cachedir, target), 'w').close()
236 244 try:
237 os.symlink(os.path.basename(fd.name), name)
245 os.symlink(target, name)
238 246 if cachedir is None:
239 247 os.unlink(name)
240 248 else:
@@ -249,7 +257,8 b' def checklink(path):'
249 257 continue
250 258 raise
251 259 finally:
252 fd.close()
260 if fd is not None:
261 fd.close()
253 262 except AttributeError:
254 263 return False
255 264 except OSError as inst:
@@ -33,6 +33,7 b' Trigger branchcache creation:'
33 33 branch2-served
34 34 checkisexec
35 35 checklink
36 checklink-target
36 37 checknoexec
37 38 rbc-names-v1
38 39 rbc-revs-v1
@@ -50,6 +51,7 b' Ensure branchcache got copied over:'
50 51 branch2-served
51 52 checkisexec
52 53 checklink
54 checklink-target
53 55
54 56 $ cat a
55 57 a
@@ -212,6 +212,8 b' r4 has hardlinks in the working dir (not'
212 212 2 r4/.hg/branch
213 213 2 r4/.hg/cache/branch2-served
214 214 2 r4/.hg/cache/checkisexec
215 3 r4/.hg/cache/checklink (?)
216 ? r4/.hg/cache/checklink-target (glob)
215 217 2 r4/.hg/cache/checknoexec
216 218 2 r4/.hg/cache/rbc-names-v1
217 219 2 r4/.hg/cache/rbc-revs-v1
@@ -250,6 +252,7 b' Update back to revision 11 in r4 should '
250 252 1 r4/.hg/branch
251 253 2 r4/.hg/cache/branch2-served
252 254 2 r4/.hg/cache/checkisexec
255 2 r4/.hg/cache/checklink-target
253 256 2 r4/.hg/cache/checknoexec
254 257 2 r4/.hg/cache/rbc-names-v1
255 258 2 r4/.hg/cache/rbc-revs-v1
@@ -674,6 +674,7 b' Missing tags2* files means the cache was'
674 674 branch2-served
675 675 checkisexec
676 676 checklink
677 checklink-target
677 678 hgtagsfnodes1
678 679 rbc-names-v1
679 680 rbc-revs-v1
@@ -700,6 +701,7 b' Running hg tags should produce tags2* fi'
700 701 branch2-served
701 702 checkisexec
702 703 checklink
704 checklink-target
703 705 hgtagsfnodes1
704 706 rbc-names-v1
705 707 rbc-revs-v1
General Comments 0
You need to be logged in to leave comments. Login now