##// END OF EJS Templates
dirstate: factor the identity getting/setting code in the dirstate map...
marmoute -
r51021:85746485 default
parent child Browse files
Show More
@@ -58,6 +58,15 b' class _dirstatemapcommon:'
58 # for consistent view between _pl() and _read() invocations
58 # for consistent view between _pl() and _read() invocations
59 self._pendingmode = None
59 self._pendingmode = None
60
60
61 def _set_identity(self):
62 self.identity = self._get_current_identity()
63
64 def _get_current_identity(self):
65 try:
66 return util.cachestat(self._opener.join(self._filename))
67 except FileNotFoundError:
68 return None
69
61 def preload(self):
70 def preload(self):
62 """Loads the underlying data, if it's not already loaded"""
71 """Loads the underlying data, if it's not already loaded"""
63 self._map
72 self._map
@@ -263,10 +272,7 b' class dirstatemap(_dirstatemapcommon):'
263
272
264 def read(self):
273 def read(self):
265 # ignore HG_PENDING because identity is used only for writing
274 # ignore HG_PENDING because identity is used only for writing
266 try:
275 self._set_identity()
267 self.identity = util.cachestat(self._opener.join(self._filename))
268 except FileNotFoundError:
269 self.identity = None
270
276
271 if self._use_dirstate_v2:
277 if self._use_dirstate_v2:
272 if not self.docket.uuid:
278 if not self.docket.uuid:
@@ -529,12 +535,7 b' if rustmod is not None:'
529 Fills the Dirstatemap when called.
535 Fills the Dirstatemap when called.
530 """
536 """
531 # ignore HG_PENDING because identity is used only for writing
537 # ignore HG_PENDING because identity is used only for writing
532 try:
538 self._set_identity()
533 self.identity = util.cachestat(
534 self._opener.join(self._filename)
535 )
536 except FileNotFoundError:
537 self.identity = None
538
539
539 if self._use_dirstate_v2:
540 if self._use_dirstate_v2:
540 if self.docket.uuid:
541 if self.docket.uuid:
General Comments 0
You need to be logged in to leave comments. Login now