Patchwork [1,of,7] util: make filestat.avoidambig() return whether ambiguity is avoided or not

login
register
mail settings
Submitter Katsunori FUJIWARA
Date June 9, 2017, 4:08 a.m.
Message ID <eff387e5c445cb7270dc.1496981301@speaknoevil>
Download mbox | patch
Permalink /patch/21262/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - June 9, 2017, 4:08 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1496980697 -32400
#      Fri Jun 09 12:58:17 2017 +0900
# Node ID eff387e5c445cb7270dc72e5140dcb96e9a07bf9
# Parent  c2cb0de2512055123517289f398b8b554c31a5ed
util: make filestat.avoidambig() return whether ambiguity is avoided or not

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1568,7 +1568,10 @@  class filestat(object):
         'old' should be previous filestat of 'path'.
 
         This skips avoiding ambiguity, if a process doesn't have
-        appropriate privileges for 'path'.
+        appropriate privileges for 'path'. This returns False in this
+        case.
+
+        Otherwise, this returns True, as "ambiguity is avoided".
         """
         advanced = (old.stat.st_mtime + 1) & 0x7fffffff
         try:
@@ -1577,8 +1580,9 @@  class filestat(object):
             if inst.errno == errno.EPERM:
                 # utime() on the file created by another user causes EPERM,
                 # if a process doesn't have appropriate privileges
-                return
+                return False
             raise
+        return True
 
     def __ne__(self, other):
         return not self == other