memfilectx: add a size method
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 03 Jun 2014 13:49:51 -0700
changeset 21710 14514dd542aa
parent 21702 99db956b88ab
child 21711 0986af9e7006
memfilectx: add a size method This method is needed to have memfilectx behave like the other file contexts. We can't just inherit this method because each file context has different behavior: filectx reads from the filelog, and workingfilectx reads from the disk. Therefore, we define memfilectx to return the size of the data in memory.
mercurial/context.py
--- a/mercurial/context.py	Sun Jun 01 16:01:01 2014 -0700
+++ b/mercurial/context.py	Tue Jun 03 13:49:51 2014 -0700
@@ -1609,6 +1609,8 @@
 
     def data(self):
         return self._data
+    def size(self):
+        return len(self.data())
     def flags(self):
         return self._flags
     def isexec(self):