Show More
@@ -349,5 +349,21 b' def hidewindow():' | |||
|
349 | 349 | """ |
|
350 | 350 | pass |
|
351 | 351 | |
|
352 | class cachestat(object): | |
|
353 | def __init__(self, path): | |
|
354 | self.stat = os.stat(path) | |
|
355 | ||
|
356 | def cacheable(self): | |
|
357 | return bool(self.stat.st_ino) | |
|
358 | ||
|
359 | def __eq__(self, other): | |
|
360 | try: | |
|
361 | return self.stat == other.stat | |
|
362 | except AttributeError: | |
|
363 | return False | |
|
364 | ||
|
365 | def __ne__(self, other): | |
|
366 | return not self == other | |
|
367 | ||
|
352 | 368 | def executablepath(): |
|
353 | 369 | return None # available on Windows only |
@@ -24,6 +24,7 b" if os.name == 'nt':" | |||
|
24 | 24 | else: |
|
25 | 25 | import posix as platform |
|
26 | 26 | |
|
27 | cachestat = platform.cachestat | |
|
27 | 28 | checkexec = platform.checkexec |
|
28 | 29 | checklink = platform.checklink |
|
29 | 30 | executablepath = platform.executablepath |
@@ -286,4 +286,11 b' def isexec(f):' | |||
|
286 | 286 | |
|
287 | 287 | from win32 import * |
|
288 | 288 | |
|
289 | class cachestat(object): | |
|
290 | def __init__(self, path): | |
|
291 | pass | |
|
292 | ||
|
293 | def cacheable(self): | |
|
294 | return False | |
|
295 | ||
|
289 | 296 | expandglobs = True |
@@ -101,6 +101,16 b' def has_inotify():' | |||
|
101 | 101 | def has_fifo(): |
|
102 | 102 | return hasattr(os, "mkfifo") |
|
103 | 103 | |
|
104 | def has_cacheable_fs(): | |
|
105 | from mercurial import util | |
|
106 | ||
|
107 | fd, path = tempfile.mkstemp(prefix=tempprefix) | |
|
108 | os.close(fd) | |
|
109 | try: | |
|
110 | return util.cachestat(path).cacheable() | |
|
111 | finally: | |
|
112 | os.remove(path) | |
|
113 | ||
|
104 | 114 | def has_lsprof(): |
|
105 | 115 | try: |
|
106 | 116 | import _lsprof |
@@ -200,6 +210,7 b' checks = {' | |||
|
200 | 210 | "baz": (has_baz, "GNU Arch baz client"), |
|
201 | 211 | "bzr": (has_bzr, "Canonical's Bazaar client"), |
|
202 | 212 | "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"), |
|
213 | "cacheable": (has_cacheable_fs, "cacheable filesystem"), | |
|
203 | 214 | "cvs": (has_cvs, "cvs client/server"), |
|
204 | 215 | "darcs": (has_darcs, "darcs client"), |
|
205 | 216 | "docutils": (has_docutils, "Docutils text processing library"), |
General Comments 0
You need to be logged in to leave comments.
Login now