Mercurial > hg
changeset 30342:fe1ee393de78
manifest: introduce memmanifestctx and memtreemanifestctx
This introduces two new classes to represent in-memory manifest instances.
Similar to memchangectx, this lets us prepare a manifest in memory, then in a
future patch we will add the apis that can commit this in memory structure.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 08 Nov 2016 08:03:43 -0800 |
parents | 3dfb5a0171c9 |
children | 952e1916ae56 |
files | mercurial/manifest.py |
diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/manifest.py Tue Nov 08 08:03:43 2016 -0800 +++ b/mercurial/manifest.py Tue Nov 08 08:03:43 2016 -0800 @@ -1323,6 +1323,17 @@ def add(self, m, transaction, link, p1, p2, added, removed): return self._revlog.add(m, transaction, link, p1, p2, added, removed) +class memmanifestctx(object): + def __init__(self, repo): + self._repo = repo + self._manifestdict = manifestdict() + + def new(self): + return memmanifestctx(self._repo) + + def read(self): + return self._manifestdict + class manifestctx(object): """A class representing a single revision of a manifest, including its contents, its parent revs, and its linkrev. @@ -1346,6 +1357,9 @@ def node(self): return self._node + def new(self): + return memmanifestctx(self._repo) + def read(self): if not self._data: if self._node == revlog.nullid: @@ -1400,6 +1414,18 @@ def find(self, key): return self.read().find(key) +class memtreemanifestctx(object): + def __init__(self, repo, dir=''): + self._repo = repo + self._dir = dir + self._treemanifest = treemanifest() + + def new(self, dir=''): + return memtreemanifestctx(self._repo, dir=dir) + + def read(self): + return self._treemanifest + class treemanifestctx(object): def __init__(self, repo, dir, node): self._repo = repo @@ -1443,6 +1469,9 @@ def node(self): return self._node + def new(self, dir=''): + return memtreemanifestctx(self._repo, dir=dir) + def readdelta(self, shallow=False): '''Returns a manifest containing just the entries that are present in this manifest, but not in its p1 manifest. This is efficient to read