Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 35323:8e1386b342f7
overlayworkingctx: inherit from committablectx instead of workingctx
We should find a better name for this context at some point. (mutablememctx?)
Differential Revision: https://phab.mercurial-scm.org/D1240
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Thu, 07 Dec 2017 16:07:06 -0800 |
parents | baf58e621363 |
children | 72fbdd373de8 |
comparison
equal
deleted
inserted
replaced
35322:baf58e621363 | 35323:8e1386b342f7 |
---|---|
1974 break | 1974 break |
1975 | 1975 |
1976 def setflags(self, l, x): | 1976 def setflags(self, l, x): |
1977 self._repo.wvfs.setflags(self._path, l, x) | 1977 self._repo.wvfs.setflags(self._path, l, x) |
1978 | 1978 |
1979 class overlayworkingctx(workingctx): | 1979 class overlayworkingctx(committablectx): |
1980 """Wraps another mutable context with a write-back cache that can be flushed | 1980 """Wraps another mutable context with a write-back cache that can be |
1981 at a later time. | 1981 converted into a commit context. |
1982 | 1982 |
1983 self._cache[path] maps to a dict with keys: { | 1983 self._cache[path] maps to a dict with keys: { |
1984 'exists': bool? | 1984 'exists': bool? |
1985 'date': date? | 1985 'date': date? |
1986 'data': str? | 1986 'data': str? |
2159 | 2159 |
2160 def filectx(self, path, filelog=None): | 2160 def filectx(self, path, filelog=None): |
2161 return overlayworkingfilectx(self._repo, path, parent=self, | 2161 return overlayworkingfilectx(self._repo, path, parent=self, |
2162 filelog=filelog) | 2162 filelog=filelog) |
2163 | 2163 |
2164 class overlayworkingfilectx(workingfilectx): | 2164 class overlayworkingfilectx(committablefilectx): |
2165 """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory | 2165 """Wrap a ``workingfilectx`` but intercepts all writes into an in-memory |
2166 cache, which can be flushed through later by calling ``flush()``.""" | 2166 cache, which can be flushed through later by calling ``flush()``.""" |
2167 | 2167 |
2168 def __init__(self, repo, path, filelog=None, parent=None): | 2168 def __init__(self, repo, path, filelog=None, parent=None): |
2169 super(overlayworkingfilectx, self).__init__(repo, path, filelog, | 2169 super(overlayworkingfilectx, self).__init__(repo, path, filelog, |