Mercurial > hg-stable
changeset 33281:6af0f023d014
vfs: replace avoiding ambiguity in abstractvfs.rename with _avoidambig
This centralizes common logic to forcibly avoid file stat ambiguity
into _avoidambig(), which was introduced by previous patch.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 04 Jul 2017 23:13:47 +0900 |
parents | 646352291f5b |
children | d1db7af81548 |
files | mercurial/vfs.py |
diffstat | 1 files changed, 2 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/vfs.py Tue Jul 04 23:13:47 2017 +0900 +++ b/mercurial/vfs.py Tue Jul 04 23:13:47 2017 +0900 @@ -195,18 +195,8 @@ dstpath = self.join(dst) oldstat = checkambig and util.filestat.frompath(dstpath) if oldstat and oldstat.stat: - def dorename(spath, dpath): - ret = util.rename(spath, dpath) - newstat = util.filestat.frompath(dpath) - if newstat.isambig(oldstat): - # stat of renamed file is ambiguous to original one - return ret, newstat.avoidambig(dpath, oldstat) - return ret, True - ret, avoided = dorename(srcpath, dstpath) - if not avoided: - # simply copy to change owner of srcpath (see issue5418) - util.copyfile(dstpath, srcpath) - ret, avoided = dorename(srcpath, dstpath) + ret = util.rename(srcpath, dstpath) + _avoidambig(dstpath, oldstat) return ret return util.rename(srcpath, dstpath)