[PATCH 7 of 8] vfs: replace avoiding ambiguity in abstractvfs.rename with _avoidambig
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Thu Jun 29 16:53:14 UTC 2017
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1498754870 -32400
# Fri Jun 30 01:47:50 2017 +0900
# Node ID 5bdabaa7c404da6074733e593516b460a1629483
# Parent b833b68a2bb86c160ea25006f9f7216fce2921f5
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.
diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -195,18 +195,8 @@ class abstractvfs(object):
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)
More information about the Mercurial-devel
mailing list