Patchwork [3,of,3,RFC] context: start pretending wvfs lives in workingctx

login
register
mail settings
Submitter Sean Farley
Date June 1, 2017, 12:25 a.m.
Message ID <40d3c9cfa9d0ff7755d9.1496276722@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/21112/
State Accepted, archived
Headers show

Comments

Sean Farley - June 1, 2017, 12:25 a.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1494537158 25200
#      Thu May 11 14:12:38 2017 -0700
# Branch wctxds
# Node ID 40d3c9cfa9d0ff7755d9db18472457c9f3fdefbd
# Parent  11f1b897d1475648a88ff0115954413f46bf4137
context: start pretending wvfs lives in workingctx

Arguably, this should just be called 'vfs'. One step at a time, though.
Based on Mads Kiilerix's work from the sprint.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
index c42c5e6..719e395 100644
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1565,10 +1565,11 @@  class workingctx(committablectx):
         super(workingctx, self).__init__(repo, text, user, date, extra, changes)
 
         # This is where working directory references should live. For now we
         # just borrow references to stuff in localrepo.
         self.wlock = self._repo.wlock
+        self.wvfs = self._repo.wvfs
 
     @property
     def dirstate(self):
         return self._repo.dirstate
 
@@ -1611,11 +1612,11 @@  class workingctx(committablectx):
     def add(self, list, prefix=""):
         join = lambda f: os.path.join(prefix, f)
         with self.wlock():
             ui, ds = self._repo.ui, self.dirstate
             rejected = []
-            lstat = self._repo.wvfs.lstat
+            lstat = self.wvfs.lstat
             for f in list:
                 scmutil.checkportable(ui, join(f))
                 try:
                     st = lstat(f)
                 except OSError:
@@ -1666,11 +1667,11 @@  class workingctx(committablectx):
                     self._repo.wwrite(f, t, fctx.flags())
                     self.dirstate.normal(f)
 
     def copy(self, source, dest):
         try:
-            st = self._repo.wvfs.lstat(dest)
+            st = self.wvfs.lstat(dest)
         except OSError as err:
             if err.errno != errno.ENOENT:
                 raise
             self._repo.ui.warn(_("%s does not exist!\n") % dest)
             return