vfs: ignore EPERM at os.utime, which avoids ambiguity at renaming (issue5418) stable
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Sun, 13 Nov 2016 06:11:56 +0900
branchstable
changeset 30320 bff5ccbe5ead
parent 30319 b496a464399c
child 30321 e0ff47999b13
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.
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Sun Nov 13 06:06:23 2016 +0900
+++ b/mercurial/scmutil.py	Sun Nov 13 06:11:56 2016 +0900
@@ -390,8 +390,7 @@
             newstat = util.filestat(dstpath)
             if newstat.isambig(oldstat):
                 # stat of renamed file is ambiguous to original one
-                advanced = (oldstat.stat.st_mtime + 1) & 0x7fffffff
-                os.utime(dstpath, (advanced, advanced))
+                newstat.avoidambig(dstpath, oldstat)
             return ret
         return util.rename(self.join(src), dstpath)