mercurial/revlog.py
changeset 48681 e845537f6adb
parent 48529 c514936d92b4
parent 48571 ccd9cb73125c
child 48761 2e949ede7350
equal deleted inserted replaced
48673:576040155dba 48681:e845537f6adb
  1969         troffset = tr.findoffset(self._indexfile)
  1969         troffset = tr.findoffset(self._indexfile)
  1970         if troffset is None:
  1970         if troffset is None:
  1971             raise error.RevlogError(
  1971             raise error.RevlogError(
  1972                 _(b"%s not found in the transaction") % self._indexfile
  1972                 _(b"%s not found in the transaction") % self._indexfile
  1973             )
  1973             )
  1974         trindex = 0
  1974         trindex = None
  1975         tr.add(self._datafile, 0)
  1975         tr.add(self._datafile, 0)
  1976 
  1976 
  1977         existing_handles = False
  1977         existing_handles = False
  1978         if self._writinghandles is not None:
  1978         if self._writinghandles is not None:
  1979             existing_handles = True
  1979             existing_handles = True
  1992         new_dfh.truncate(0)  # drop any potentially existing data
  1992         new_dfh.truncate(0)  # drop any potentially existing data
  1993         try:
  1993         try:
  1994             with self._indexfp() as read_ifh:
  1994             with self._indexfp() as read_ifh:
  1995                 for r in self:
  1995                 for r in self:
  1996                     new_dfh.write(self._getsegmentforrevs(r, r, df=read_ifh)[1])
  1996                     new_dfh.write(self._getsegmentforrevs(r, r, df=read_ifh)[1])
  1997                     if troffset <= self.start(r) + r * self.index.entry_size:
  1997                     if (
       
  1998                         trindex is None
       
  1999                         and troffset
       
  2000                         <= self.start(r) + r * self.index.entry_size
       
  2001                     ):
  1998                         trindex = r
  2002                         trindex = r
  1999                 new_dfh.flush()
  2003                 new_dfh.flush()
       
  2004 
       
  2005             if trindex is None:
       
  2006                 trindex = 0
  2000 
  2007 
  2001             with self.__index_new_fp() as fp:
  2008             with self.__index_new_fp() as fp:
  2002                 self._format_flags &= ~FLAG_INLINE_DATA
  2009                 self._format_flags &= ~FLAG_INLINE_DATA
  2003                 self._inline = False
  2010                 self._inline = False
  2004                 for i in self:
  2011                 for i in self: