##// END OF EJS Templates
dirstate: remove layering violation around writing dirstate out...
FUJIWARA Katsunori -
r26747:beff0b24 default
parent child Browse files
Show More
@@ -648,7 +648,7 b' class dirstate(object):'
648 self._pl = (parent, nullid)
648 self._pl = (parent, nullid)
649 self._dirty = True
649 self._dirty = True
650
650
651 def write(self, repo=None):
651 def write(self, tr=False):
652 if not self._dirty:
652 if not self._dirty:
653 return
653 return
654
654
@@ -660,17 +660,13 b' class dirstate(object):'
660 time.sleep(delaywrite)
660 time.sleep(delaywrite)
661
661
662 filename = self._filename
662 filename = self._filename
663 if not repo:
663 if tr is False: # not explicitly specified
664 tr = None
665 if self._opener.lexists(self._pendingfilename):
664 if self._opener.lexists(self._pendingfilename):
666 # if pending file already exists, in-memory changes
665 # if pending file already exists, in-memory changes
667 # should be written into it, because it has priority
666 # should be written into it, because it has priority
668 # to '.hg/dirstate' at reading under HG_PENDING mode
667 # to '.hg/dirstate' at reading under HG_PENDING mode
669 filename = self._pendingfilename
668 filename = self._pendingfilename
670 else:
669 elif tr:
671 tr = repo.currenttransaction()
672
673 if tr:
674 # 'dirstate.write()' is not only for writing in-memory
670 # 'dirstate.write()' is not only for writing in-memory
675 # changes out, but also for dropping ambiguous timestamp.
671 # changes out, but also for dropping ambiguous timestamp.
676 # delayed writing re-raise "ambiguous timestamp issue".
672 # delayed writing re-raise "ambiguous timestamp issue".
@@ -678,7 +674,7 b' class dirstate(object):'
678 # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan
674 # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan
679
675
680 # emulate dropping timestamp in 'parsers.pack_dirstate'
676 # emulate dropping timestamp in 'parsers.pack_dirstate'
681 now = _getfsnow(repo.vfs)
677 now = _getfsnow(self._opener)
682 dmap = self._map
678 dmap = self._map
683 for f, e in dmap.iteritems():
679 for f, e in dmap.iteritems():
684 if e[0] == 'n' and e[3] == now:
680 if e[0] == 'n' and e[3] == now:
General Comments 0
You need to be logged in to leave comments. Login now