##// 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 58 # for consistent view between _pl() and _read() invocations
59 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 70 def preload(self):
62 71 """Loads the underlying data, if it's not already loaded"""
63 72 self._map
@@ -263,10 +272,7 b' class dirstatemap(_dirstatemapcommon):'
263 272
264 273 def read(self):
265 274 # ignore HG_PENDING because identity is used only for writing
266 try:
267 self.identity = util.cachestat(self._opener.join(self._filename))
268 except FileNotFoundError:
269 self.identity = None
275 self._set_identity()
270 276
271 277 if self._use_dirstate_v2:
272 278 if not self.docket.uuid:
@@ -529,12 +535,7 b' if rustmod is not None:'
529 535 Fills the Dirstatemap when called.
530 536 """
531 537 # ignore HG_PENDING because identity is used only for writing
532 try:
533 self.identity = util.cachestat(
534 self._opener.join(self._filename)
535 )
536 except FileNotFoundError:
537 self.identity = None
538 self._set_identity()
538 539
539 540 if self._use_dirstate_v2:
540 541 if self.docket.uuid:
General Comments 0
You need to be logged in to leave comments. Login now