diff mercurial/vfs.py @ 32772:7ad95626f6a7

filestat: move __init__ to frompath constructor We're going to add a `fromfp` constructor soon, and this also allows a filestat object for a non-existent file to be created.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 10 Jun 2017 14:09:54 -0700
parents ed66ec39933f
children 5dcbd2045dcb
line wrap: on
line diff
--- a/mercurial/vfs.py	Sat Jun 10 14:07:31 2017 -0700
+++ b/mercurial/vfs.py	Sat Jun 10 14:09:54 2017 -0700
@@ -176,11 +176,11 @@
         """
         srcpath = self.join(src)
         dstpath = self.join(dst)
-        oldstat = checkambig and util.filestat(dstpath)
+        oldstat = checkambig and util.filestat.frompath(dstpath)
         if oldstat and oldstat.stat:
             def dorename(spath, dpath):
                 ret = util.rename(spath, dpath)
-                newstat = util.filestat(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)
@@ -625,12 +625,12 @@
     """
     def __init__(self, fh):
         super(checkambigatclosing, self).__init__(fh)
-        object.__setattr__(self, r'_oldstat', util.filestat(fh.name))
+        object.__setattr__(self, r'_oldstat', util.filestat.frompath(fh.name))
 
     def _checkambig(self):
         oldstat = self._oldstat
         if oldstat.stat:
-            newstat = util.filestat(self._origfh.name)
+            newstat = util.filestat.frompath(self._origfh.name)
             if newstat.isambig(oldstat):
                 # stat of changed file is ambiguous to original one
                 newstat.avoidambig(self._origfh.name, oldstat)