verify: report existence of journal
authorSune Foldager <cryo@cyanite.org>
Mon, 02 Nov 2009 10:15:04 +0100
changeset 9690 b33d70849a20
parent 9689 57cee011ffcb
child 9691 f8e1456e1c2c
verify: report existence of journal
mercurial/verify.py
tests/test-repair-strip.out
tests/test-verify
tests/test-verify.out
--- a/mercurial/verify.py	Sun Nov 01 03:26:10 2009 +0100
+++ b/mercurial/verify.py	Mon Nov 02 10:15:04 2009 +0100
@@ -7,6 +7,7 @@
 
 from node import nullid, short
 from i18n import _
+import os
 import revlog, util, error
 
 def verify(repo):
@@ -105,6 +106,9 @@
         seen[n] = i
         return lr
 
+    if os.path.exists(repo.sjoin("journal")):
+        ui.warn(_("abandoned transaction found - run hg recover\n"))
+
     revlogv1 = cl.version != revlog.REVLOGV0
     if ui.verbose or not revlogv1:
         ui.status(_("repository uses revlog format %d\n") %
--- a/tests/test-repair-strip.out	Sun Nov 01 03:26:10 2009 +0100
+++ b/tests/test-repair-strip.out	Mon Nov 02 10:15:04 2009 +0100
@@ -10,6 +10,7 @@
 rollback failed - please run hg recover
 abort: Permission denied .hg/store/data/b.i
 % after update 0, strip 2
+abandoned transaction found - run hg recover
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
@@ -59,6 +60,7 @@
 rollback failed - please run hg recover
 abort: Permission denied .hg/store/00manifest.i
 % after update 0, strip 2
+abandoned transaction found - run hg recover
 checking changesets
 checking manifests
  manifest@?: rev 2 points to nonexistent changeset 2
--- a/tests/test-verify	Sun Nov 01 03:26:10 2009 +0100
+++ b/tests/test-verify	Mon Nov 02 10:15:04 2009 +0100
@@ -14,6 +14,12 @@
 hg verify
 
 echo
+echo % verify with journal
+touch .hg/store/journal
+hg verify
+rm .hg/store/journal
+
+echo
 echo % introduce some bugs in repo
 cd .hg/store/data
 mv _f_o_o.txt.i X_f_o_o.txt.i
--- a/tests/test-verify.out	Sun Nov 01 03:26:10 2009 +0100
+++ b/tests/test-verify.out	Mon Nov 02 10:15:04 2009 +0100
@@ -10,6 +10,14 @@
 checking files
 3 files, 1 changesets, 3 total revisions
 
+% verify with journal
+abandoned transaction found - run hg recover
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+3 files, 1 changesets, 3 total revisions
+
 % introduce some bugs in repo
 
 % verify