[PATCH] transaction: display data about why the transaction failed to rollback

Boris Feld boris.feld at octobus.net
Fri Nov 9 22:45:32 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1541617178 -3600
#      Wed Nov 07 19:59:38 2018 +0100
# Node ID 73479612de7345e9ba400e3178315ab578de2c54
# Parent  a2c4502e409b72b22053fc31772368416c876b66
# EXP-Topic explain-failure
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 73479612de73
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.

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -582,8 +582,9 @@ class transaction(util.transactional):
                           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") % exc)
         finally:
             self._journal = None
             self._releasefn(self, False) # notify failure of transaction
diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t
--- a/tests/test-repair-strip.t
+++ b/tests/test-repair-strip.t
@@ -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


More information about the Mercurial-devel mailing list