##// END OF EJS Templates
dirstate: add identity information to detect simultaneous changing in storage...
FUJIWARA Katsunori -
r32750:b698921e default
parent child Browse files
Show More
@@ -159,6 +159,11 b' class dirstate(object):'
159 return self._copymap
159 return self._copymap
160
160
161 @propertycache
161 @propertycache
162 def _identity(self):
163 self._read()
164 return self._identity
165
166 @propertycache
162 def _nonnormalset(self):
167 def _nonnormalset(self):
163 nonnorm, otherparents = nonnormalentries(self._map)
168 nonnorm, otherparents = nonnormalentries(self._map)
164 self._otherparentset = otherparents
169 self._otherparentset = otherparents
@@ -426,6 +431,8 b' class dirstate(object):'
426 def _read(self):
431 def _read(self):
427 self._map = {}
432 self._map = {}
428 self._copymap = {}
433 self._copymap = {}
434 # ignore HG_PENDING because identity is used only for writing
435 self._identity = util.filestat(self._opener.join(self._filename))
429 try:
436 try:
430 fp = self._opendirstatefile()
437 fp = self._opendirstatefile()
431 try:
438 try:
@@ -476,7 +483,8 b' class dirstate(object):'
476 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
483 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
477 check whether the dirstate has changed before rereading it.'''
484 check whether the dirstate has changed before rereading it.'''
478
485
479 for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
486 for a in ("_map", "_copymap", "_identity",
487 "_filefoldmap", "_dirfoldmap", "_branch",
480 "_pl", "_dirs", "_ignore", "_nonnormalset",
488 "_pl", "_dirs", "_ignore", "_nonnormalset",
481 "_otherparentset"):
489 "_otherparentset"):
482 if a in self.__dict__:
490 if a in self.__dict__:
@@ -741,6 +749,14 b' class dirstate(object):'
741
749
742 self._dirty = True
750 self._dirty = True
743
751
752 def identity(self):
753 '''Return identity of dirstate itself to detect changing in storage
754
755 If identity of previous dirstate is equal to this, writing
756 changes based on the former dirstate out can keep consistency.
757 '''
758 return self._identity
759
744 def write(self, tr):
760 def write(self, tr):
745 if not self._dirty:
761 if not self._dirty:
746 return
762 return
General Comments 0
You need to be logged in to leave comments. Login now