transactions: don't show a backtrace when journal exists
Now we simply print a message on how to recover.
--- a/mercurial/localrepo.py Wed Jan 16 11:14:51 2008 -0600
+++ b/mercurial/localrepo.py Wed Jan 16 11:32:25 2008 -0600
@@ -519,6 +519,10 @@
if self._transref and self._transref():
return self._transref().nest()
+ # abort here if the journal already exists
+ if os.path.exists(self.sjoin("journal")):
+ raise repo.RepoError(_("journal already exists - run hg recover"))
+
# save dirstate for rollback
try:
ds = self.opener("dirstate").read()
--- a/mercurial/transaction.py Wed Jan 16 11:14:51 2008 -0600
+++ b/mercurial/transaction.py Wed Jan 16 11:32:25 2008 -0600
@@ -18,10 +18,6 @@
def __init__(self, report, opener, journal, after=None):
self.journal = None
- # abort here if the journal already exists
- if os.path.exists(journal):
- raise AssertionError(_("journal already exists - run hg recover"))
-
self.count = 1
self.report = report
self.opener = opener
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-journal-exists Wed Jan 16 11:32:25 2008 -0600
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+hg init
+echo a > a
+hg ci -Am0
+
+touch .hg/store/journal
+
+echo foo > a
+hg ci -Am0
+
+hg recover
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-journal-exists.out Wed Jan 16 11:32:25 2008 -0600
@@ -0,0 +1,8 @@
+adding a
+abort: journal already exists - run hg recover!
+rolling back interrupted transaction
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 1 changesets, 1 total revisions