comparison mercurial/store.py @ 47234:616b8f412676

revlogv2: introduce a very basic docket file This is the first stone toward using a docket file in revlogv2. Right now the docket is very basic and only store the version number (which is -also- stored into the index file…) and the other files have fixed name. This new implementation break transactionally… but they are no test checking transactionally for revlogv2… So I take this as an opportunity to start small. They are no usage of revlogv2 outside of tests anyway. The docket keeps the `.i` naming used by previous version index to preserve a unique entry point. We could decide to use a different name and look it up first, or to fully rework this in a future "store" version. However that does not seems necessary right now. We will re-introduces transactionality (and associated testing…) in a later changesets. A long list of TODOs have been added to the relevant comment. Differential Revision: https://phab.mercurial-scm.org/D10624
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:34:11 +0200
parents 8f6165c90163
children 0a3fa41fa719
comparison
equal deleted inserted replaced
47233:bcafcd779d2e 47234:616b8f412676
387 b'obsstore', 387 b'obsstore',
388 b'requires', 388 b'requires',
389 ] 389 ]
390 390
391 REVLOG_FILES_MAIN_EXT = (b'.i', b'i.tmpcensored') 391 REVLOG_FILES_MAIN_EXT = (b'.i', b'i.tmpcensored')
392 REVLOG_FILES_OTHER_EXT = (b'.d', b'.n', b'.nd', b'd.tmpcensored') 392 REVLOG_FILES_OTHER_EXT = (b'.idx', b'.d', b'.n', b'.nd', b'd.tmpcensored')
393 # files that are "volatile" and might change between listing and streaming 393 # files that are "volatile" and might change between listing and streaming
394 # 394 #
395 # note: the ".nd" file are nodemap data and won't "change" but they might be 395 # note: the ".nd" file are nodemap data and won't "change" but they might be
396 # deleted. 396 # deleted.
397 REVLOG_FILES_VOLATILE_EXT = (b'.n', b'.nd') 397 REVLOG_FILES_VOLATILE_EXT = (b'.n', b'.nd')
398 398
399 # some exception to the above matching 399 # some exception to the above matching
400 EXCLUDED = re.compile(b'.*undo\.[^/]+\.nd?$') 400 EXCLUDED = re.compile(b'.*undo\.[^/]+\.(nd?|i)$')
401 401
402 402
403 def is_revlog(f, kind, st): 403 def is_revlog(f, kind, st):
404 if kind != stat.S_IFREG: 404 if kind != stat.S_IFREG:
405 return None 405 return None
406 return revlog_type(f) 406 return revlog_type(f)
407 407
408 408
409 def revlog_type(f): 409 def revlog_type(f):
410 if f.endswith(REVLOG_FILES_MAIN_EXT): 410 if f.endswith(REVLOG_FILES_MAIN_EXT) and EXCLUDED.match(f) is None:
411 return FILEFLAGS_REVLOG_MAIN 411 return FILEFLAGS_REVLOG_MAIN
412 elif f.endswith(REVLOG_FILES_OTHER_EXT) and EXCLUDED.match(f) is None: 412 elif f.endswith(REVLOG_FILES_OTHER_EXT) and EXCLUDED.match(f) is None:
413 t = FILETYPE_FILELOG_OTHER 413 t = FILETYPE_FILELOG_OTHER
414 if f.endswith(REVLOG_FILES_VOLATILE_EXT): 414 if f.endswith(REVLOG_FILES_VOLATILE_EXT):
415 t |= FILEFLAGS_VOLATILE 415 t |= FILEFLAGS_VOLATILE