From patchwork Sat Nov 12 21:16:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2, of, 3, STABLE] vfs: ignore EPERM at os.utime, which avoids ambiguity at renaming (issue5418) From: Katsunori FUJIWARA X-Patchwork-Id: 17528 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 13 Nov 2016 06:16:09 +0900 # HG changeset patch # User FUJIWARA Katsunori # Date 1478985116 -32400 # Sun Nov 13 06:11:56 2016 +0900 # Branch stable # Node ID bff5ccbe5ead56aac7fff30f48a486007d469f3f # Parent b496a464399cb68628b09e52aa8cf379c98428e6 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. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -390,8 +390,7 @@ class abstractvfs(object): 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)