# HG changeset patch # User Pierre-Yves David # Date 2014-10-18 05:19:05 # Node ID 1b51d1b05482f187d2005db8be4e9c5b46a488b9 # Parent ba033f461f004857a28f6ea5f9ed0eac18d6e37d 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. diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -342,6 +342,7 @@ class transaction(object): # 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 diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t --- a/tests/test-bundle2-exchange.t +++ b/tests/test-bundle2-exchange.t @@ -304,6 +304,15 @@ Check final content. 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 @@ Doing the actual push: hook abort 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 +