[PATCH 3 of 3 RFC] context: start pretending wvfs lives in workingctx
Sean Farley
sean at farley.io
Thu Jun 1 00:25:22 UTC 2017
# HG changeset patch
# User Sean Farley <sean at 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.
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
More information about the Mercurial-devel
mailing list