comparison mercurial/scmutil.py @ 30320:bff5ccbe5ead stable

vfs: ignore EPERM at os.utime, which avoids ambiguity at renaming (issue5418) According to POSIX specification, just having group write access to a file causes EPERM at invocation of os.utime() with an explicit time information (e.g. working on the repository shared by group access permission). To ignore EPERM at renaming in such case, this patch makes vfs.rename() use filestat.avoidambig() introduced by previous patch.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 13 Nov 2016 06:11:56 +0900
parents 96a2278ee732
children e0ff47999b13
comparison
equal deleted inserted replaced
30319:b496a464399c 30320:bff5ccbe5ead
388 if oldstat and oldstat.stat: 388 if oldstat and oldstat.stat:
389 ret = util.rename(self.join(src), dstpath) 389 ret = util.rename(self.join(src), dstpath)
390 newstat = util.filestat(dstpath) 390 newstat = util.filestat(dstpath)
391 if newstat.isambig(oldstat): 391 if newstat.isambig(oldstat):
392 # stat of renamed file is ambiguous to original one 392 # stat of renamed file is ambiguous to original one
393 advanced = (oldstat.stat.st_mtime + 1) & 0x7fffffff 393 newstat.avoidambig(dstpath, oldstat)
394 os.utime(dstpath, (advanced, advanced))
395 return ret 394 return ret
396 return util.rename(self.join(src), dstpath) 395 return util.rename(self.join(src), dstpath)
397 396
398 def readlink(self, path): 397 def readlink(self, path):
399 return os.readlink(self.join(path)) 398 return os.readlink(self.join(path))