Mercurial > hg-stable
changeset 35330:2e1c32a9c97b
overlayworkingctx: add _manifest, files(), added(), removed(), modified()
Differential Revision: https://phab.mercurial-scm.org/D1238
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Thu, 07 Dec 2017 16:07:06 -0800 |
parents | d901a88891fe |
children | baf58e621363 |
files | mercurial/context.py |
diffstat | 1 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Fri Dec 08 12:14:38 2017 -0800 +++ b/mercurial/context.py Thu Dec 07 16:07:06 2017 -0800 @@ -2014,6 +2014,43 @@ else: return self._wrappedctx[path].data() + @propertycache + def _manifest(self): + parents = self.parents() + man = parents[0].manifest().copy() + + flag = self._flagfunc + for path in self.added(): + man[path] = addednodeid + man.setflag(path, flag(path)) + for path in self.modified(): + man[path] = modifiednodeid + man.setflag(path, flag(path)) + for path in self.removed(): + del man[path] + return man + + @propertycache + def _flagfunc(self): + def f(path): + return self._cache[path]['flags'] + return f + + def files(self): + return sorted(self.added() + self.modified() + self.removed()) + + def modified(self): + return [f for f in self._cache.keys() if self._cache[f]['exists'] and + self._existsinparent(f)] + + def added(self): + return [f for f in self._cache.keys() if self._cache[f]['exists'] and + not self._existsinparent(f)] + + def removed(self): + return [f for f in self._cache.keys() if + not self._cache[f]['exists'] and self._existsinparent(f)] + def isinmemory(self): return True