Patchwork [3,of,8,RFC] memfilectx: add remove and write methods

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2014, 7:52 p.m.
Message ID <124225c16d40a0c2707e.1407441130@laptop.att.net>
Download mbox | patch
Permalink /patch/5319/
State Accepted
Headers show

Comments

Sean Farley - Aug. 7, 2014, 7:52 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1406337626 18000
#      Fri Jul 25 20:20:26 2014 -0500
# Node ID 124225c16d40a0c2707e346c67e2a7a332ca0509
# Parent  50a462c913c3796a9fd44678b258dc09f7de54f5
memfilectx: add remove and write methods

Similar to the previous patch for workingfilectx, this patch will allow
abstracting localrepo.remove / write method to refactor working directory code
but instead operate on files in memory.
Matt Mackall - Aug. 7, 2014, 9:47 p.m.
On Thu, 2014-08-07 at 14:52 -0500, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1406337626 18000
> #      Fri Jul 25 20:20:26 2014 -0500
> # Node ID 124225c16d40a0c2707e346c67e2a7a332ca0509
> # Parent  50a462c913c3796a9fd44678b258dc09f7de54f5
> memfilectx: add remove and write methods

These first three are queued, thanks.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1682,5 +1682,14 @@  class memfilectx(committablefilectx):
         return len(self.data())
     def flags(self):
         return self._flags
     def renamed(self):
         return self._copied
+
+    def remove(self, ignoremissing=False):
+        """wraps unlink for a repo's working directory"""
+        # need to figure out what to do here
+        del self._changectx[self._path]
+
+    def write(self, data, flags):
+        """wraps repo.wwrite"""
+        self._data = data