mercurial/changelog.py
changeset 23292 e44399c494ab
parent 23281 f60ed8cf4afc
child 24030 828dc8db5515
equal deleted inserted replaced
23291:03d2d6931836 23292:e44399c494ab
   271     def _writepending(self, tr):
   271     def _writepending(self, tr):
   272         "create a file containing the unfinalized state for pretxnchangegroup"
   272         "create a file containing the unfinalized state for pretxnchangegroup"
   273         if self._delaybuf:
   273         if self._delaybuf:
   274             # make a temporary copy of the index
   274             # make a temporary copy of the index
   275             fp1 = self._realopener(self.indexfile)
   275             fp1 = self._realopener(self.indexfile)
   276             fp2 = self._realopener(self.indexfile + ".a", "w")
   276             pendingfilename = self.indexfile + ".a"
       
   277             # register as a temp file to ensure cleanup on failure
       
   278             tr.registertmp(pendingfilename)
       
   279             # write existing data
       
   280             fp2 = self._realopener(pendingfilename, "w")
   277             fp2.write(fp1.read())
   281             fp2.write(fp1.read())
   278             # add pending data
   282             # add pending data
   279             fp2.write("".join(self._delaybuf))
   283             fp2.write("".join(self._delaybuf))
   280             fp2.close()
   284             fp2.close()
   281             # switch modes so finalize can simply rename
   285             # switch modes so finalize can simply rename