[PATCH 2 of 3] verify: report existence of journal

Sune Foldager cryo at cyanite.org
Fri Oct 30 16:42:43 UTC 2009


# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1256920868 -3600
# Node ID 60aedecda1538d2ce1932f466b8f1925ae3c91a8
# Parent  035e516c15acca1abb1ce845bc1ec9ade88f3c20
verify: report existence of journal

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -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(_("partially aborted transaction found - you should run hg recover\n"))
+
     revlogv1 = cl.version != revlog.REVLOGV0
     if ui.verbose or not revlogv1:
         ui.status(_("repository uses revlog format %d\n") %
diff --git a/tests/test-repair-strip.out b/tests/test-repair-strip.out
--- a/tests/test-repair-strip.out
+++ b/tests/test-repair-strip.out
@@ -10,6 +10,7 @@
 rollback failed - please run hg recover
 abort: Permission denied .hg/store/data/b.i
 % after update 0, strip 2
+partially aborted transaction found - you should 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
+partially aborted transaction found - you should run hg recover
 checking changesets
 checking manifests
  manifest@?: rev 2 points to nonexistent changeset 2
diff --git a/tests/test-verify b/tests/test-verify
--- a/tests/test-verify
+++ b/tests/test-verify
@@ -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
diff --git a/tests/test-verify.out b/tests/test-verify.out
--- a/tests/test-verify.out
+++ b/tests/test-verify.out
@@ -10,6 +10,14 @@
 checking files
 3 files, 1 changesets, 3 total revisions
 
+% verify with journal
+partially aborted transaction found - you should 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



More information about the Mercurial-devel mailing list