Mercurial > hg
comparison hgext/largefiles/reposetup.py @ 30191:328545c7d8a1 stable
largefiles: fix 'deleted' files sometimes persistently appearing with R status
A code snippet that has been around since largefiles was introduced was wrong:
Standins no longer found in lfdirstate has *not* been removed -
they have probably just been deleted ... or not created.
This wrong reporting did that 'up -C' didn't undo the change and didn't sync
the two dirstates.
Instead of reporting such files as removed, propagate the deletion to the
standin file and report the file as deleted.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 17 Oct 2016 17:12:24 +0200 |
parents | cc497d2830b0 |
children | 3afde791dce1 |
comparison
equal
deleted
inserted
replaced
30190:56b930238036 | 30191:328545c7d8a1 |
---|---|
162 if sfindirstate(f)] | 162 if sfindirstate(f)] |
163 # Don't waste time getting the ignored and unknown | 163 # Don't waste time getting the ignored and unknown |
164 # files from lfdirstate | 164 # files from lfdirstate |
165 unsure, s = lfdirstate.status(match, [], False, listclean, | 165 unsure, s = lfdirstate.status(match, [], False, listclean, |
166 False) | 166 False) |
167 (modified, added, removed, clean) = (s.modified, s.added, | 167 (modified, added, removed, deleted, clean) = ( |
168 s.removed, s.clean) | 168 s.modified, s.added, s.removed, s.deleted, s.clean) |
169 if parentworking: | 169 if parentworking: |
170 for lfile in unsure: | 170 for lfile in unsure: |
171 standin = lfutil.standin(lfile) | 171 standin = lfutil.standin(lfile) |
172 if standin not in ctx1: | 172 if standin not in ctx1: |
173 # from second parent | 173 # from second parent |
204 # then, largefiles not managed also in the target | 204 # then, largefiles not managed also in the target |
205 # context should be excluded from 'removed'. | 205 # context should be excluded from 'removed'. |
206 removed = [lfile for lfile in removed | 206 removed = [lfile for lfile in removed |
207 if lfutil.standin(lfile) in ctx1] | 207 if lfutil.standin(lfile) in ctx1] |
208 | 208 |
209 # Standins no longer found in lfdirstate has been | 209 # Standins no longer found in lfdirstate have been deleted |
210 # removed | |
211 for standin in ctx1.walk(lfutil.getstandinmatcher(self)): | 210 for standin in ctx1.walk(lfutil.getstandinmatcher(self)): |
212 lfile = lfutil.splitstandin(standin) | 211 lfile = lfutil.splitstandin(standin) |
213 if not match(lfile): | 212 if not match(lfile): |
214 continue | 213 continue |
215 if lfile not in lfdirstate: | 214 if lfile not in lfdirstate: |
216 removed.append(lfile) | 215 deleted.append(lfile) |
216 # Sync "largefile has been removed" back to the | |
217 # standin. Removing a file as a side effect of | |
218 # running status is gross, but the alternatives (if | |
219 # any) are worse. | |
220 self.wvfs.unlink(standin) | |
217 | 221 |
218 # Filter result lists | 222 # Filter result lists |
219 result = list(result) | 223 result = list(result) |
220 | 224 |
221 # Largefiles are not really removed when they're | 225 # Largefiles are not really removed when they're |
235 result[5] = set(result[5]).difference(lfiles) | 239 result[5] = set(result[5]).difference(lfiles) |
236 # combine normal files and largefiles | 240 # combine normal files and largefiles |
237 normals = [[fn for fn in filelist | 241 normals = [[fn for fn in filelist |
238 if not lfutil.isstandin(fn)] | 242 if not lfutil.isstandin(fn)] |
239 for filelist in result] | 243 for filelist in result] |
240 lfstatus = (modified, added, removed, s.deleted, [], [], | 244 lfstatus = (modified, added, removed, deleted, [], [], |
241 clean) | 245 clean) |
242 result = [sorted(list1 + list2) | 246 result = [sorted(list1 + list2) |
243 for (list1, list2) in zip(normals, lfstatus)] | 247 for (list1, list2) in zip(normals, lfstatus)] |
244 else: # not against working directory | 248 else: # not against working directory |
245 result = [[lfutil.splitstandin(f) or f for f in items] | 249 result = [[lfutil.splitstandin(f) or f for f in items] |