comparison mercurial/util.py @ 30427:854190becacb

merge with stable
author Augie Fackler <augie@google.com>
date Wed, 16 Nov 2016 23:29:28 -0500
parents 10514a92860e b496a464399c
children 1156ec81f709
comparison
equal deleted inserted replaced
30426:c27614f2dec1 30427:854190becacb
1497 try: 1497 try:
1498 return (self.stat.st_ctime == old.stat.st_ctime) 1498 return (self.stat.st_ctime == old.stat.st_ctime)
1499 except AttributeError: 1499 except AttributeError:
1500 return False 1500 return False
1501 1501
1502 def avoidambig(self, path, old):
1503 """Change file stat of specified path to avoid ambiguity
1504
1505 'old' should be previous filestat of 'path'.
1506
1507 This skips avoiding ambiguity, if a process doesn't have
1508 appropriate privileges for 'path'.
1509 """
1510 advanced = (old.stat.st_mtime + 1) & 0x7fffffff
1511 try:
1512 os.utime(path, (advanced, advanced))
1513 except OSError as inst:
1514 if inst.errno == errno.EPERM:
1515 # utime() on the file created by another user causes EPERM,
1516 # if a process doesn't have appropriate privileges
1517 return
1518 raise
1519
1502 def __ne__(self, other): 1520 def __ne__(self, other):
1503 return not self == other 1521 return not self == other
1504 1522
1505 class atomictempfile(object): 1523 class atomictempfile(object):
1506 '''writable file object that atomically updates a file 1524 '''writable file object that atomically updates a file