transaction: display data about why the transaction failed to rollback
authorBoris Feld <boris.feld@octobus.net>
Wed, 07 Nov 2018 19:59:38 +0100
changeset 40579 aca09df32819
parent 40578 db61a18148a4
child 40580 ab893a99b645
transaction: display data about why the transaction failed to rollback We saw more of these a while back. Having more data available would be nice.
mercurial/transaction.py
tests/test-repair-strip.t
--- a/mercurial/transaction.py	Sat Nov 10 12:07:26 2018 +0900
+++ b/mercurial/transaction.py	Wed Nov 07 19:59:38 2018 +0100
@@ -21,6 +21,9 @@
     pycompat,
     util,
 )
+from .utils import (
+    stringutil,
+)
 
 version = 2
 
@@ -582,8 +585,10 @@
                           self._vfsmap, self._entries, self._backupentries,
                           False, checkambigfiles=self._checkambigfiles)
                 self._report(_("rollback completed\n"))
-            except BaseException:
+            except BaseException as exc:
                 self._report(_("rollback failed - please run hg recover\n"))
+                self._report(_("(failure reason: %s)\n")
+                             % stringutil.forcebytestr(exc))
         finally:
             self._journal = None
             self._releasefn(self, False) # notify failure of transaction
--- a/tests/test-repair-strip.t	Sat Nov 10 12:07:26 2018 +0900
+++ b/tests/test-repair-strip.t	Wed Nov 07 19:59:38 2018 +0100
@@ -51,6 +51,7 @@
   transaction abort!
   failed to truncate data/b.i
   rollback failed - please run hg recover
+  (failure reason: [Errno 13] Permission denied .hg/store/data/b.i')
   strip failed, backup bundle
   abort: Permission denied .hg/store/data/b.i
   % after update 0, strip 2
@@ -104,6 +105,7 @@
   transaction abort!
   failed to truncate 00manifest.i
   rollback failed - please run hg recover
+  (failure reason: [Errno 13] Permission denied .hg/store/00manifest.i')
   strip failed, backup bundle
   abort: Permission denied .hg/store/00manifest.i
   % after update 0, strip 2