Mercurial > hg-stable
comparison mercurial/context.py @ 21710:14514dd542aa
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.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 03 Jun 2014 13:49:51 -0700 |
parents | 5b2a2bea8cb6 |
children | bc773e9505e3 |
comparison
equal
deleted
inserted
replaced
21702:99db956b88ab | 21710:14514dd542aa |
---|---|
1607 if copied: | 1607 if copied: |
1608 self._copied = (copied, nullid) | 1608 self._copied = (copied, nullid) |
1609 | 1609 |
1610 def data(self): | 1610 def data(self): |
1611 return self._data | 1611 return self._data |
1612 def size(self): | |
1613 return len(self.data()) | |
1612 def flags(self): | 1614 def flags(self): |
1613 return self._flags | 1615 return self._flags |
1614 def isexec(self): | 1616 def isexec(self): |
1615 return 'x' in self._flags | 1617 return 'x' in self._flags |
1616 def islink(self): | 1618 def islink(self): |