--- a/tests/test-strip.t Thu Aug 06 21:00:16 2015 -0400
+++ b/tests/test-strip.t Sat Aug 08 14:50:03 2015 -0700
@@ -826,3 +826,26 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: mergeCD
+
+Error during post-close callback of the strip transaction
+(They should be gracefully handled and reported)
+
+ $ cat > ../crashstrip.py << EOF
+ > from mercurial import error
+ > def reposetup(ui, repo):
+ > class crashstriprepo(repo.__class__):
+ > def transaction(self, desc, *args, **kwargs):
+ > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs)
+ > if desc == 'strip':
+ > def crash(tra): raise error.Abort('boom')
+ > tr.addpostclose('crash', crash)
+ > return tr
+ > repo.__class__ = crashstriprepo
+ > EOF
+ $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
+ saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
+ strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
+ abort: boom
+ [255]
+
+