comparison mercurial/dirstatemap.py @ 48119:aec5b0981c26

dirstatemap: introduce a common base for the dirstatemap class We have two dirstatemaps class. One for the python version of the dirstate map and one for the Rust version (that has a python wrapper to deal with some aspect of it). We end up with duplicated code between them, so we introduce a common base class to start migrating common code in them. Differential Revision: https://phab.mercurial-scm.org/D11564
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 01 Oct 2021 16:14:29 +0200
parents 2c2788ce0257
children fe6617715464
comparison
equal deleted inserted replaced
48118:5105a9975407 48119:aec5b0981c26
33 DirstateItem = rustmod.DirstateItem 33 DirstateItem = rustmod.DirstateItem
34 34
35 rangemask = 0x7FFFFFFF 35 rangemask = 0x7FFFFFFF
36 36
37 37
38 class dirstatemap(object): 38 class _dirstatemapcommon(object):
39 """
40 Methods that are identical for both implementations of the dirstatemap
41 class, with and without Rust extensions enabled.
42 """
43
44
45 class dirstatemap(_dirstatemapcommon):
39 """Map encapsulating the dirstate's contents. 46 """Map encapsulating the dirstate's contents.
40 47
41 The dirstate contains the following state: 48 The dirstate contains the following state:
42 49
43 - `identity` is the identity of the dirstate file, which can be used to 50 - `identity` is the identity of the dirstate file, which can be used to
458 return f 465 return f
459 466
460 467
461 if rustmod is not None: 468 if rustmod is not None:
462 469
463 class dirstatemap(object): 470 class dirstatemap(_dirstatemapcommon):
464 def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2): 471 def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
465 self._use_dirstate_v2 = use_dirstate_v2 472 self._use_dirstate_v2 = use_dirstate_v2
466 self._nodeconstants = nodeconstants 473 self._nodeconstants = nodeconstants
467 self._ui = ui 474 self._ui = ui
468 self._opener = opener 475 self._opener = opener