##// END OF EJS Templates
strip: use the 'finally: tr.release' pattern during stripping...
Pierre-Yves David -
r26012:d815a599 stable
parent child Browse files
Show More
@@ -173,9 +173,8 b' def strip(ui, repo, nodelist, backup=Tru'
173 if troffset == 0:
173 if troffset == 0:
174 repo.store.markremoved(file)
174 repo.store.markremoved(file)
175 tr.close()
175 tr.close()
176 except: # re-raises
176 finally:
177 tr.abort()
177 tr.release()
178 raise
179
178
180 if saveheads or savebases:
179 if saveheads or savebases:
181 ui.note(_("adding branch\n"))
180 ui.note(_("adding branch\n"))
@@ -826,3 +826,26 b' strip backup content'
826 date: Thu Jan 01 00:00:00 1970 +0000
826 date: Thu Jan 01 00:00:00 1970 +0000
827 summary: mergeCD
827 summary: mergeCD
828
828
829
830 Error during post-close callback of the strip transaction
831 (They should be gracefully handled and reported)
832
833 $ cat > ../crashstrip.py << EOF
834 > from mercurial import error
835 > def reposetup(ui, repo):
836 > class crashstriprepo(repo.__class__):
837 > def transaction(self, desc, *args, **kwargs):
838 > tr = super(crashstriprepo, self).transaction(self, desc, *args, **kwargs)
839 > if desc == 'strip':
840 > def crash(tra): raise error.Abort('boom')
841 > tr.addpostclose('crash', crash)
842 > return tr
843 > repo.__class__ = crashstriprepo
844 > EOF
845 $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
846 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob)
847 strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
848 abort: boom
849 [255]
850
851
General Comments 0
You need to be logged in to leave comments. Login now