changeset 33283:634b259079c5

workingfilectx: add exists, lexists Switch the lone call in merge.py to use it. As with past refactors, the goal is to make wctx hot-swappable with an in-memory context in the future. This change should be a no-op today.
author Phil Cohen <phillco@fb.com>
date Tue, 04 Jul 2017 22:35:52 -0700
parents d1db7af81548
children b2670290eab4
files mercurial/context.py mercurial/merge.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Jul 04 23:13:47 2017 +0900
+++ b/mercurial/context.py	Tue Jul 04 22:35:52 2017 -0700
@@ -1879,6 +1879,12 @@
                 raise
             return (t, tz)
 
+    def exists(self):
+        return self._repo.wvfs.exists(self._path)
+
+    def lexists(self):
+        return self._repo.wvfs.lexists(self._path)
+
     def audit(self):
         return self._repo.wvfs.audit(self._path)
 
--- a/mercurial/merge.py	Tue Jul 04 23:13:47 2017 +0900
+++ b/mercurial/merge.py	Tue Jul 04 22:35:52 2017 -0700
@@ -9,7 +9,6 @@
 
 import errno
 import hashlib
-import os
 import shutil
 import struct
 
@@ -1206,7 +1205,7 @@
 
     # remove renamed files after safely stored
     for f in moves:
-        if os.path.lexists(repo.wjoin(f)):
+        if wctx[f].lexists():
             repo.ui.debug("removing %s\n" % f)
             wctx[f].audit()
             wctx[f].remove()