Show More
@@ -733,20 +733,11 b' class dirstate(object):' | |||||
733 |
|
733 | |||
734 | filename = self._filename |
|
734 | filename = self._filename | |
735 | if tr: |
|
735 | if tr: | |
736 | # 'dirstate.write()' is not only for writing in-memory |
|
|||
737 | # changes out, but also for dropping ambiguous timestamp. |
|
|||
738 | # delayed writing re-raise "ambiguous timestamp issue". |
|
|||
739 | # See also the wiki page below for detail: |
|
|||
740 | # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan |
|
|||
741 |
|
||||
742 | # record when mtime start to be ambiguous |
|
|||
743 | now = timestamp.get_fs_now(self._opener) |
|
|||
744 |
|
||||
745 | # delay writing in-memory changes out |
|
736 | # delay writing in-memory changes out | |
746 | tr.addfilegenerator( |
|
737 | tr.addfilegenerator( | |
747 | b'dirstate', |
|
738 | b'dirstate', | |
748 | (self._filename,), |
|
739 | (self._filename,), | |
749 |
lambda f: self._writedirstate(tr, f |
|
740 | lambda f: self._writedirstate(tr, f), | |
750 | location=b'plain', |
|
741 | location=b'plain', | |
751 | ) |
|
742 | ) | |
752 | return |
|
743 | return | |
@@ -765,7 +756,7 b' class dirstate(object):' | |||||
765 | """ |
|
756 | """ | |
766 | self._plchangecallbacks[category] = callback |
|
757 | self._plchangecallbacks[category] = callback | |
767 |
|
758 | |||
768 |
def _writedirstate(self, tr, st |
|
759 | def _writedirstate(self, tr, st): | |
769 | # notify callbacks about parents change |
|
760 | # notify callbacks about parents change | |
770 | if self._origpl is not None and self._origpl != self._pl: |
|
761 | if self._origpl is not None and self._origpl != self._pl: | |
771 | for c, callback in sorted( |
|
762 | for c, callback in sorted( | |
@@ -774,12 +765,7 b' class dirstate(object):' | |||||
774 | callback(self, self._origpl, self._pl) |
|
765 | callback(self, self._origpl, self._pl) | |
775 | self._origpl = None |
|
766 | self._origpl = None | |
776 |
|
767 | |||
777 | if now is None: |
|
768 | self._map.write(tr, st) | |
778 | # use the modification time of the newly created temporary file as the |
|
|||
779 | # filesystem's notion of 'now' |
|
|||
780 | now = timestamp.mtime_of(util.fstat(st)) |
|
|||
781 |
|
||||
782 | self._map.write(tr, st, now) |
|
|||
783 | self._dirty = False |
|
769 | self._dirty = False | |
784 |
|
770 | |||
785 | def _dirignore(self, f): |
|
771 | def _dirignore(self, f): |
@@ -444,7 +444,7 b' class dirstatemap(_dirstatemapcommon):' | |||||
444 | self.__getitem__ = self._map.__getitem__ |
|
444 | self.__getitem__ = self._map.__getitem__ | |
445 | self.get = self._map.get |
|
445 | self.get = self._map.get | |
446 |
|
446 | |||
447 |
def write(self, tr, st |
|
447 | def write(self, tr, st): | |
448 | if self._use_dirstate_v2: |
|
448 | if self._use_dirstate_v2: | |
449 | packed, meta = v2.pack_dirstate(self._map, self.copymap) |
|
449 | packed, meta = v2.pack_dirstate(self._map, self.copymap) | |
450 | self.write_v2_no_append(tr, st, meta, packed) |
|
450 | self.write_v2_no_append(tr, st, meta, packed) | |
@@ -655,7 +655,7 b' if rustmod is not None:' | |||||
655 | self._map |
|
655 | self._map | |
656 | return self.identity |
|
656 | return self.identity | |
657 |
|
657 | |||
658 |
def write(self, tr, st |
|
658 | def write(self, tr, st): | |
659 | if not self._use_dirstate_v2: |
|
659 | if not self._use_dirstate_v2: | |
660 | p1, p2 = self.parents() |
|
660 | p1, p2 = self.parents() | |
661 | packed = self._map.write_v1(p1, p2) |
|
661 | packed = self._map.write_v1(p1, p2) |
General Comments 0
You need to be logged in to leave comments.
Login now