Mercurial > hg
changeset 32747:1a79de471d56
vfs: factor out "rename and avoid ambiguity" to reuse
This makes subsequent patch simple.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 09 Jun 2017 12:58:18 +0900 |
parents | 77f354ae1123 |
children | ed66ec39933f |
files | mercurial/vfs.py |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/vfs.py Fri Jun 09 12:58:17 2017 +0900 +++ b/mercurial/vfs.py Fri Jun 09 12:58:18 2017 +0900 @@ -177,11 +177,14 @@ dstpath = self.join(dst) oldstat = checkambig and util.filestat(dstpath) if oldstat and oldstat.stat: - ret = util.rename(self.join(src), dstpath) - newstat = util.filestat(dstpath) - if newstat.isambig(oldstat): - # stat of renamed file is ambiguous to original one - newstat.avoidambig(dstpath, oldstat) + def dorename(spath, dpath): + ret = util.rename(spath, dpath) + newstat = util.filestat(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(self.join(src), dstpath) return ret return util.rename(self.join(src), dstpath)