Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 48382:991e6f728b50
status: adapt largefile to gather stats at lookup time
See the core code for details of why we are doing this.
We don't factor the code in a common function yet, because we will have to adapt
a bit more things in the largefile case at the end of the series.
Differential Revision: https://phab.mercurial-scm.org/D11786
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 18 Nov 2021 22:46:50 +0100 |
parents | 1e98f9b5bc71 |
children | 322525db4c98 |
comparison
equal
deleted
inserted
replaced
48381:41f40f35278a | 48382:991e6f728b50 |
---|---|
30 sparse, | 30 sparse, |
31 util, | 31 util, |
32 vfs as vfsmod, | 32 vfs as vfsmod, |
33 ) | 33 ) |
34 from mercurial.utils import hashutil | 34 from mercurial.utils import hashutil |
35 from mercurial.dirstateutils import timestamp | |
35 | 36 |
36 shortname = b'.hglf' | 37 shortname = b'.hglf' |
37 shortnameslash = shortname + b'/' | 38 shortnameslash = shortname + b'/' |
38 longname = b'largefiles' | 39 longname = b'largefiles' |
39 | 40 |
245 match = matchmod.always() | 246 match = matchmod.always() |
246 unsure, s = lfdirstate.status( | 247 unsure, s = lfdirstate.status( |
247 match, subrepos=[], ignored=False, clean=False, unknown=False | 248 match, subrepos=[], ignored=False, clean=False, unknown=False |
248 ) | 249 ) |
249 modified, clean = s.modified, s.clean | 250 modified, clean = s.modified, s.clean |
251 wctx = repo[None] | |
250 for lfile in unsure: | 252 for lfile in unsure: |
251 try: | 253 try: |
252 fctx = pctx[standin(lfile)] | 254 fctx = pctx[standin(lfile)] |
253 except LookupError: | 255 except LookupError: |
254 fctx = None | 256 fctx = None |
255 if not fctx or readasstandin(fctx) != hashfile(repo.wjoin(lfile)): | 257 if not fctx or readasstandin(fctx) != hashfile(repo.wjoin(lfile)): |
256 modified.append(lfile) | 258 modified.append(lfile) |
257 else: | 259 else: |
258 clean.append(lfile) | 260 clean.append(lfile) |
259 lfdirstate.set_clean(lfile) | 261 st = wctx[lfile].lstat() |
262 mode = st.st_mode | |
263 size = st.st_size | |
264 mtime = timestamp.mtime_of(st) | |
265 cache_data = (mode, size, mtime) | |
266 lfdirstate.set_clean(lfile, cache_data) | |
260 return s | 267 return s |
261 | 268 |
262 | 269 |
263 def listlfiles(repo, rev=None, matcher=None): | 270 def listlfiles(repo, rev=None, matcher=None): |
264 """return a list of largefiles in the working copy or the | 271 """return a list of largefiles in the working copy or the |