changeset 22073:0c48bc3d0eb2

workingfilectx: add remove and write methods This patch will allow abstracting localrepo.remove / write method to refactor working directory code.
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 02 Jul 2014 14:01:01 -0500
parents 443ef664fb55
children fbe967b027bd
files mercurial/context.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Jul 25 19:36:01 2014 -0500
+++ b/mercurial/context.py	Wed Jul 02 14:01:01 2014 -0500
@@ -1556,6 +1556,14 @@
         # invert comparison to reuse the same code path
         return fctx.cmp(self)
 
+    def remove(self, ignoremissing=False):
+        """wraps unlink for a repo's working directory"""
+        util.unlinkpath(self._repo.wjoin(self._path), ignoremissing)
+
+    def write(self, data, flags):
+        """wraps repo.wwrite"""
+        self._repo.wwrite(self._path, data, flags)
+
 class memctx(committablectx):
     """Use memctx to perform in-memory commits via localrepo.commitctx().