Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 47280:1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
For now, the format is the same except with an additional marker at the start.
This marker is redundant: for existing repositories it is `.hg/requires` that
determines which format to use. For new repositories, it is the new
`format.exp-dirstate-v2` config. There is no upgrade or downgrade so far.
Most of the changes are about plumbing a boolean through layers of APIs to
indicate which format should be used.
Differential Revision: https://phab.mercurial-scm.org/D10719
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 19 May 2021 13:15:00 +0200 |
parents | d55b71393907 |
children | fa18a3bc40e8 |
comparison
equal
deleted
inserted
replaced
47279:40b51c28b242 | 47280:1766130fe9ba |
---|---|
23 encoding, | 23 encoding, |
24 error, | 24 error, |
25 httpconnection, | 25 httpconnection, |
26 match as matchmod, | 26 match as matchmod, |
27 pycompat, | 27 pycompat, |
28 requirements, | |
28 scmutil, | 29 scmutil, |
29 sparse, | 30 sparse, |
30 util, | 31 util, |
31 vfs as vfsmod, | 32 vfs as vfsmod, |
32 ) | 33 ) |
195 the repo root, but it is saved in .hg/largefiles/dirstate. | 196 the repo root, but it is saved in .hg/largefiles/dirstate. |
196 """ | 197 """ |
197 vfs = repo.vfs | 198 vfs = repo.vfs |
198 lfstoredir = longname | 199 lfstoredir = longname |
199 opener = vfsmod.vfs(vfs.join(lfstoredir)) | 200 opener = vfsmod.vfs(vfs.join(lfstoredir)) |
201 use_dirstate_v2 = requirements.DIRSTATE_V2_REQUIREMENT in repo.requirements | |
200 lfdirstate = largefilesdirstate( | 202 lfdirstate = largefilesdirstate( |
201 opener, | 203 opener, |
202 ui, | 204 ui, |
203 repo.root, | 205 repo.root, |
204 repo.dirstate._validate, | 206 repo.dirstate._validate, |
205 lambda: sparse.matcher(repo), | 207 lambda: sparse.matcher(repo), |
206 repo.nodeconstants, | 208 repo.nodeconstants, |
209 use_dirstate_v2, | |
207 ) | 210 ) |
208 | 211 |
209 # If the largefiles dirstate does not exist, populate and create | 212 # If the largefiles dirstate does not exist, populate and create |
210 # it. This ensures that we create it on the first meaningful | 213 # it. This ensures that we create it on the first meaningful |
211 # largefiles operation in a new clone. | 214 # largefiles operation in a new clone. |