Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 35321: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 | 228916ca12b5 |
children | baf58e621363 |
comparison
equal
deleted
inserted
replaced
35320:d901a88891fe | 35321:2e1c32a9c97b |
---|---|
2012 raise error.ProgrammingError("No such file or directory: %s" % | 2012 raise error.ProgrammingError("No such file or directory: %s" % |
2013 path) | 2013 path) |
2014 else: | 2014 else: |
2015 return self._wrappedctx[path].data() | 2015 return self._wrappedctx[path].data() |
2016 | 2016 |
2017 @propertycache | |
2018 def _manifest(self): | |
2019 parents = self.parents() | |
2020 man = parents[0].manifest().copy() | |
2021 | |
2022 flag = self._flagfunc | |
2023 for path in self.added(): | |
2024 man[path] = addednodeid | |
2025 man.setflag(path, flag(path)) | |
2026 for path in self.modified(): | |
2027 man[path] = modifiednodeid | |
2028 man.setflag(path, flag(path)) | |
2029 for path in self.removed(): | |
2030 del man[path] | |
2031 return man | |
2032 | |
2033 @propertycache | |
2034 def _flagfunc(self): | |
2035 def f(path): | |
2036 return self._cache[path]['flags'] | |
2037 return f | |
2038 | |
2039 def files(self): | |
2040 return sorted(self.added() + self.modified() + self.removed()) | |
2041 | |
2042 def modified(self): | |
2043 return [f for f in self._cache.keys() if self._cache[f]['exists'] and | |
2044 self._existsinparent(f)] | |
2045 | |
2046 def added(self): | |
2047 return [f for f in self._cache.keys() if self._cache[f]['exists'] and | |
2048 not self._existsinparent(f)] | |
2049 | |
2050 def removed(self): | |
2051 return [f for f in self._cache.keys() if | |
2052 not self._cache[f]['exists'] and self._existsinparent(f)] | |
2053 | |
2017 def isinmemory(self): | 2054 def isinmemory(self): |
2018 return True | 2055 return True |
2019 | 2056 |
2020 def filedate(self, path): | 2057 def filedate(self, path): |
2021 if self.isdirty(path): | 2058 if self.isdirty(path): |