##// END OF EJS Templates
overlayworkingctx: track copy information in the context...
Phil Cohen -
r35294:8b3a636b default
parent child Browse files
Show More
@@ -1985,6 +1985,7 class overlayworkingctx(workingctx):
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.
@@ -2022,6 +2023,18 class overlayworkingctx(workingctx):
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']:
@@ -2086,6 +2099,7 class overlayworkingctx(workingctx):
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):
@@ -2122,16 +2136,17 class overlayworkingfilectx(workingfilec
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)
2134
2146
2147 def markcopied(self, origin):
2148 self._parent.markcopied(self._path, origin)
2149
2135 def audit(self):
2150 def audit(self):
2136 pass
2151 pass
2137
2152
General Comments 0
You need to be logged in to leave comments. Login now