Mercurial > hg
changeset 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 | 1b2957b27203 |
files | mercurial/transaction.py tests/test-bundle2-exchange.t |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/transaction.py Fri Oct 17 21:57:32 2014 -0700 +++ b/mercurial/transaction.py Fri Oct 17 22:19:05 2014 -0700 @@ -342,6 +342,7 @@ # remove callback since the data will have been flushed any = self._pendingcallback.pop(cat)(self) self._anypending = self._anypending or any + self._anypending |= self._generatefiles(suffix='.pending') return self._anypending @active
--- a/tests/test-bundle2-exchange.t Fri Oct 17 21:57:32 2014 -0700 +++ b/tests/test-bundle2-exchange.t Fri Oct 17 22:19:05 2014 -0700 @@ -304,6 +304,15 @@ 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'} +(check that no 'pending' files remain) + + $ ls -1 other/.hg/bookmarks* + other/.hg/bookmarks + $ ls -1 other/.hg/store/phaseroots* + other/.hg/store/phaseroots + $ ls -1 other/.hg/store/00changelog.i* + other/.hg/store/00changelog.i + Error Handling ============== @@ -479,4 +488,12 @@ abort: b2x-pretransactionclose.failpush hook exited with status 1 [255] +(check that no 'pending' files remain) + $ ls -1 other/.hg/bookmarks* + other/.hg/bookmarks + $ ls -1 other/.hg/store/phaseroots* + other/.hg/store/phaseroots + $ ls -1 other/.hg/store/00changelog.i* + other/.hg/store/00changelog.i +