Mercurial > public > mercurial-scm > hg
diff mercurial/util.py @ 30417:854190becacb
merge with stable
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 16 Nov 2016 23:29:28 -0500 |
parents | 10514a92860e b496a464399c |
children | 1156ec81f709 |
line wrap: on
line diff
--- a/mercurial/util.py Sat Nov 12 03:06:07 2016 +0000 +++ b/mercurial/util.py Wed Nov 16 23:29:28 2016 -0500 @@ -1499,6 +1499,24 @@ except AttributeError: return False + def avoidambig(self, path, old): + """Change file stat of specified path to avoid ambiguity + + 'old' should be previous filestat of 'path'. + + This skips avoiding ambiguity, if a process doesn't have + appropriate privileges for 'path'. + """ + advanced = (old.stat.st_mtime + 1) & 0x7fffffff + try: + os.utime(path, (advanced, advanced)) + except OSError as inst: + if inst.errno == errno.EPERM: + # utime() on the file created by another user causes EPERM, + # if a process doesn't have appropriate privileges + return + raise + def __ne__(self, other): return not self == other