mercurial/context.py
changeset 35293 8b3a636bb341
parent 35289 2f8c476c49fe
child 35294 d4f65050f3c5
equal deleted inserted replaced
35292:306a8604741f 35293:8b3a636bb341
  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?
  1987         'flags': str?
  1987         'flags': str?
       
  1988         'copied': str? (path or None)
  1988     }
  1989     }
  1989     If `exists` is True, `flags` must be non-None and 'date' is non-None. If it
  1990     If `exists` is True, `flags` must be non-None and 'date' is non-None. If it
  1990     is `False`, the file was deleted.
  1991     is `False`, the file was deleted.
  1991     """
  1992     """
  1992 
  1993 
  2020         if self.isdirty(path):
  2021         if self.isdirty(path):
  2021             return self._cache[path]['date']
  2022             return self._cache[path]['date']
  2022         else:
  2023         else:
  2023             return self._wrappedctx[path].date()
  2024             return self._wrappedctx[path].date()
  2024 
  2025 
       
  2026     def markcopied(self, path, origin):
       
  2027         if self.isdirty(path):
       
  2028             self._cache[path]['copied'] = origin
       
  2029         else:
       
  2030             raise error.ProgrammingError('markcopied() called on clean context')
       
  2031 
       
  2032     def copydata(self, path):
       
  2033         if self.isdirty(path):
       
  2034             return self._cache[path]['copied']
       
  2035         else:
       
  2036             raise error.ProgrammingError('copydata() called on clean context')
       
  2037 
  2025     def flags(self, path):
  2038     def flags(self, path):
  2026         if self.isdirty(path):
  2039         if self.isdirty(path):
  2027             if self._cache[path]['exists']:
  2040             if self._cache[path]['exists']:
  2028                 return self._cache[path]['flags']
  2041                 return self._cache[path]['flags']
  2029             else:
  2042             else:
  2084         self._cache[path] = {
  2097         self._cache[path] = {
  2085             'exists': exists,
  2098             'exists': exists,
  2086             'data': data,
  2099             'data': data,
  2087             'date': date,
  2100             'date': date,
  2088             'flags': flags,
  2101             'flags': flags,
       
  2102             'copied': None,
  2089         }
  2103         }
  2090 
  2104 
  2091     def filectx(self, path, filelog=None):
  2105     def filectx(self, path, filelog=None):
  2092         return overlayworkingfilectx(self._repo, path, parent=self,
  2106         return overlayworkingfilectx(self._repo, path, parent=self,
  2093                                      filelog=filelog)
  2107                                      filelog=filelog)
  2120 
  2134 
  2121     def lexists(self):
  2135     def lexists(self):
  2122         return self._parent.exists(self._path)
  2136         return self._parent.exists(self._path)
  2123 
  2137 
  2124     def renamed(self):
  2138     def renamed(self):
  2125         # Copies are currently tracked in the dirstate as before. Straight copy
  2139         path = self._parent.copydata(self._path)
  2126         # from workingfilectx.
  2140         if not path:
  2127         rp = self._repo.dirstate.copied(self._path)
       
  2128         if not rp:
       
  2129             return None
  2141             return None
  2130         return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
  2142         return path, self._changectx._parents[0]._manifest.get(path, nullid)
  2131 
  2143 
  2132     def size(self):
  2144     def size(self):
  2133         return self._parent.size(self._path)
  2145         return self._parent.size(self._path)
       
  2146 
       
  2147     def markcopied(self, origin):
       
  2148         self._parent.markcopied(self._path, origin)
  2134 
  2149 
  2135     def audit(self):
  2150     def audit(self):
  2136         pass
  2151         pass
  2137 
  2152 
  2138     def flags(self):
  2153     def flags(self):