Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/transaction.py @ 23358:1b51d1b05482
transaction: write pending generated files
Such file are generated with a .pending prefix. It is up to the reader to
implement the necessary logic for reading pending files.
We add a test to ensure pending files are properly cleaned-up in both success and
error cases.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 17 Oct 2014 22:19:05 -0700 |
parents | ba033f461f00 |
children | 0ff6b65afeb0 |
comparison
equal
deleted
inserted
replaced
23357:ba033f461f00 | 23358:1b51d1b05482 |
---|---|
340 categories = sorted(self._pendingcallback) | 340 categories = sorted(self._pendingcallback) |
341 for cat in categories: | 341 for cat in categories: |
342 # remove callback since the data will have been flushed | 342 # remove callback since the data will have been flushed |
343 any = self._pendingcallback.pop(cat)(self) | 343 any = self._pendingcallback.pop(cat)(self) |
344 self._anypending = self._anypending or any | 344 self._anypending = self._anypending or any |
345 self._anypending |= self._generatefiles(suffix='.pending') | |
345 return self._anypending | 346 return self._anypending |
346 | 347 |
347 @active | 348 @active |
348 def addfinalize(self, category, callback): | 349 def addfinalize(self, category, callback): |
349 """add a callback to be called when the transaction is closed | 350 """add a callback to be called when the transaction is closed |