##// END OF EJS Templates
util: add utility function to skip avoiding file stat ambiguity if EPERM...
FUJIWARA Katsunori -
r30319:b496a464 stable
parent child Browse files
Show More
@@ -1497,6 +1497,24 b' class filestat(object):'
1497 except AttributeError:
1497 except AttributeError:
1498 return False
1498 return False
1499
1499
1500 def avoidambig(self, path, old):
1501 """Change file stat of specified path to avoid ambiguity
1502
1503 'old' should be previous filestat of 'path'.
1504
1505 This skips avoiding ambiguity, if a process doesn't have
1506 appropriate privileges for 'path'.
1507 """
1508 advanced = (old.stat.st_mtime + 1) & 0x7fffffff
1509 try:
1510 os.utime(path, (advanced, advanced))
1511 except OSError as inst:
1512 if inst.errno == errno.EPERM:
1513 # utime() on the file created by another user causes EPERM,
1514 # if a process doesn't have appropriate privileges
1515 return
1516 raise
1517
1500 def __ne__(self, other):
1518 def __ne__(self, other):
1501 return not self == other
1519 return not self == other
1502
1520
General Comments 0
You need to be logged in to leave comments. Login now