Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 35285:3ceebf497057
overlayworkingctx: remove flushall()
Differential Revision: https://phab.mercurial-scm.org/D1216
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Fri, 01 Dec 2017 00:07:23 -0800 |
parents | 010179e21e91 |
children | 307b1689e3f8 |
comparison
equal
deleted
inserted
replaced
35284:1b03407e808d | 35285:3ceebf497057 |
---|---|
1651 return matchmod.match(r.root, r.getcwd(), pats, include, exclude, | 1651 return matchmod.match(r.root, r.getcwd(), pats, include, exclude, |
1652 default, auditor=r.auditor, ctx=self, | 1652 default, auditor=r.auditor, ctx=self, |
1653 listsubrepos=listsubrepos, badfn=badfn, | 1653 listsubrepos=listsubrepos, badfn=badfn, |
1654 icasefs=icasefs) | 1654 icasefs=icasefs) |
1655 | 1655 |
1656 def flushall(self): | |
1657 pass # For overlayworkingfilectx compatibility. | |
1658 | |
1659 def _filtersuspectsymlink(self, files): | 1656 def _filtersuspectsymlink(self, files): |
1660 if not files or self._repo.dirstate._checklink: | 1657 if not files or self._repo.dirstate._checklink: |
1661 return files | 1658 return files |
1662 | 1659 |
1663 # Symlink placeholders may get non-symlink-like contents | 1660 # Symlink placeholders may get non-symlink-like contents |
2072 else: | 2069 else: |
2073 raise error.ProgrammingError("No such file or directory: %s" % | 2070 raise error.ProgrammingError("No such file or directory: %s" % |
2074 self._path) | 2071 self._path) |
2075 return self._wrappedctx[path].size() | 2072 return self._wrappedctx[path].size() |
2076 | 2073 |
2077 def flushall(self): | |
2078 for path in self._writeorder: | |
2079 entry = self._cache[path] | |
2080 if entry['exists']: | |
2081 self._wrappedctx[path].clearunknown() | |
2082 if entry['data'] is not None: | |
2083 if entry['flags'] is None: | |
2084 raise error.ProgrammingError('data set but not flags') | |
2085 self._wrappedctx[path].write( | |
2086 entry['data'], | |
2087 entry['flags']) | |
2088 else: | |
2089 self._wrappedctx[path].setflags( | |
2090 'l' in entry['flags'], | |
2091 'x' in entry['flags']) | |
2092 else: | |
2093 self._wrappedctx[path].remove(path) | |
2094 self._clean() | |
2095 | |
2096 def isdirty(self, path): | 2074 def isdirty(self, path): |
2097 return path in self._cache | 2075 return path in self._cache |
2098 | 2076 |
2099 def _clean(self): | 2077 def _clean(self): |
2100 self._cache = {} | 2078 self._cache = {} |
2101 self._writeorder = [] | |
2102 | 2079 |
2103 def _markdirty(self, path, exists, data=None, date=None, flags=''): | 2080 def _markdirty(self, path, exists, data=None, date=None, flags=''): |
2104 if path not in self._cache: | |
2105 self._writeorder.append(path) | |
2106 | |
2107 self._cache[path] = { | 2081 self._cache[path] = { |
2108 'exists': exists, | 2082 'exists': exists, |
2109 'data': data, | 2083 'data': data, |
2110 'date': date, | 2084 'date': date, |
2111 'flags': flags, | 2085 'flags': flags, |