##// END OF EJS Templates
dirstatemap: use a common __init__ for dirstatemap...
marmoute -
r48932:fe661771 default
parent child Browse files
Show More
@@ -41,6 +41,20 b' class _dirstatemapcommon(object):'
41 class, with and without Rust extensions enabled.
41 class, with and without Rust extensions enabled.
42 """
42 """
43
43
44 def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
45 self._use_dirstate_v2 = use_dirstate_v2
46 self._nodeconstants = nodeconstants
47 self._ui = ui
48 self._opener = opener
49 self._root = root
50 self._filename = b'dirstate'
51 self._nodelen = 20 # Also update Rust code when changing this!
52 self._parents = None
53 self._dirtyparents = False
54
55 # for consistent view between _pl() and _read() invocations
56 self._pendingmode = None
57
44
58
45 class dirstatemap(_dirstatemapcommon):
59 class dirstatemap(_dirstatemapcommon):
46 """Map encapsulating the dirstate's contents.
60 """Map encapsulating the dirstate's contents.
@@ -77,21 +91,13 b' class dirstatemap(_dirstatemapcommon):'
77 """
91 """
78
92
79 def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
93 def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
80 self._ui = ui
94 super(dirstatemap, self).__init__(
81 self._opener = opener
95 ui, opener, root, nodeconstants, use_dirstate_v2
82 self._root = root
96 )
83 self._filename = b'dirstate'
97 if self._use_dirstate_v2:
84 self._nodelen = 20
98 msg = "Dirstate V2 not supportedi"
85 self._nodeconstants = nodeconstants
99 msg += "(should have detected unsupported requirement)"
86 assert (
100 raise error.ProgrammingError(msg)
87 not use_dirstate_v2
88 ), "should have detected unsupported requirement"
89
90 self._parents = None
91 self._dirtyparents = False
92
93 # for consistent view between _pl() and _read() invocations
94 self._pendingmode = None
95
101
96 @propertycache
102 @propertycache
97 def _map(self):
103 def _map(self):
@@ -469,20 +475,11 b' if rustmod is not None:'
469
475
470 class dirstatemap(_dirstatemapcommon):
476 class dirstatemap(_dirstatemapcommon):
471 def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
477 def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
472 self._use_dirstate_v2 = use_dirstate_v2
478 super(dirstatemap, self).__init__(
473 self._nodeconstants = nodeconstants
479 ui, opener, root, nodeconstants, use_dirstate_v2
474 self._ui = ui
480 )
475 self._opener = opener
476 self._root = root
477 self._filename = b'dirstate'
478 self._nodelen = 20 # Also update Rust code when changing this!
479 self._parents = None
480 self._dirtyparents = False
481 self._docket = None
481 self._docket = None
482
482
483 # for consistent view between _pl() and _read() invocations
484 self._pendingmode = None
485
486 def addfile(
483 def addfile(
487 self,
484 self,
488 f,
485 f,
General Comments 0
You need to be logged in to leave comments. Login now