Mercurial > hg
comparison mercurial/dirstatemap.py @ 48138:38488d488ec1
dirstate-item: change the internal storage and constructor value
This should be closer to what we do need and what we can actually reliably
record.
In practice it means that we abandon the prospect of storing much more refined
data for now. We don't have the necessary information nor code using it right
now. So it seems safer to just use a clearer version of what we had so far.
See the documentation changes for details.
Differential Revision: https://phab.mercurial-scm.org/D11557
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 01 Oct 2021 20:35:30 +0200 |
parents | 25836b0029f5 |
children | 98b3eb6c1479 |
comparison
equal
deleted
inserted
replaced
48137:25836b0029f5 | 48138:38488d488ec1 |
---|---|
135 new = False | 135 new = False |
136 entry = self.get(filename) | 136 entry = self.get(filename) |
137 if entry is None: | 137 if entry is None: |
138 self._dirs_incr(filename) | 138 self._dirs_incr(filename) |
139 entry = DirstateItem( | 139 entry = DirstateItem( |
140 p1_tracked=False, | |
141 p2_tracked=False, | |
142 wc_tracked=True, | 140 wc_tracked=True, |
143 merged=False, | |
144 clean_p1=False, | |
145 clean_p2=False, | |
146 possibly_dirty=False, | |
147 parentfiledata=None, | |
148 ) | 141 ) |
149 | 142 |
150 self._insert_entry(filename, entry) | 143 self._insert_entry(filename, entry) |
151 new = True | 144 new = True |
152 elif not entry.tracked: | 145 elif not entry.tracked: |
206 if not (p1_tracked or p2_tracked or wc_tracked): | 199 if not (p1_tracked or p2_tracked or wc_tracked): |
207 old_entry = self._map.get(filename) | 200 old_entry = self._map.get(filename) |
208 self._drop_entry(filename) | 201 self._drop_entry(filename) |
209 self._dirs_decr(filename, old_entry=old_entry) | 202 self._dirs_decr(filename, old_entry=old_entry) |
210 return | 203 return |
211 elif merged: | 204 |
212 pass | 205 p2_info = merged or clean_p2 |
213 elif not (p1_tracked or p2_tracked) and wc_tracked: | 206 if merged: |
214 pass # file is added, nothing special to adjust | 207 assert p1_tracked |
215 elif (p1_tracked or p2_tracked) and not wc_tracked: | 208 |
216 pass | 209 has_meaningful_mtime = not possibly_dirty |
217 elif clean_p2 and wc_tracked: | |
218 pass | |
219 elif not p1_tracked and p2_tracked and wc_tracked: | |
220 clean_p2 = True | |
221 elif possibly_dirty: | |
222 pass | |
223 elif wc_tracked: | |
224 # this is a "normal" file | |
225 if parentfiledata is None: | |
226 msg = b'failed to pass parentfiledata for a normal file: %s' | |
227 msg %= filename | |
228 raise error.ProgrammingError(msg) | |
229 else: | |
230 assert False, 'unreachable' | |
231 | 210 |
232 old_entry = self._map.get(filename) | 211 old_entry = self._map.get(filename) |
233 self._dirs_incr(filename, old_entry) | 212 self._dirs_incr(filename, old_entry) |
234 entry = DirstateItem( | 213 entry = DirstateItem( |
235 wc_tracked=wc_tracked, | 214 wc_tracked=wc_tracked, |
236 p1_tracked=p1_tracked, | 215 p1_tracked=p1_tracked, |
237 p2_tracked=p2_tracked, | 216 p2_info=p2_info, |
238 merged=merged, | 217 has_meaningful_mtime=has_meaningful_mtime, |
239 clean_p1=clean_p1, | |
240 clean_p2=clean_p2, | |
241 possibly_dirty=possibly_dirty, | |
242 parentfiledata=parentfiledata, | 218 parentfiledata=parentfiledata, |
243 ) | 219 ) |
244 self._insert_entry(filename, entry) | 220 self._insert_entry(filename, entry) |
245 | 221 |
246 | 222 |