changeset 7141:8d1bdaf842de

issue 1144: prevent traceback on verify of bundles
author John Mulligan <phlogistonjohn@asynchrono.us>
date Sat, 18 Oct 2008 14:43:14 -0400
parents beeeb0cd73e7
children 2bbdae4f39d1 9364c3304ca2
files mercurial/verify.py tests/test-bundle tests/test-bundle.out
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/verify.py	Sat Oct 18 21:11:44 2008 +0200
+++ b/mercurial/verify.py	Sat Oct 18 14:43:14 2008 -0400
@@ -28,6 +28,9 @@
     cl = repo.changelog
     mf = repo.manifest
 
+    if not repo.cancopy():
+        raise util.Abort(_("cannot verify bundle or remote repos"))
+
     def err(linkrev, msg, filename=None):
         if linkrev != None:
             badrevs[linkrev] = True
--- a/tests/test-bundle	Sat Oct 18 21:11:44 2008 +0200
+++ b/tests/test-bundle	Sat Oct 18 14:43:14 2008 -0400
@@ -129,3 +129,14 @@
 cd ../orig
 hg incoming ../bundle.hg
 cd ..
+
+# test for http://www.selenic.com/mercurial/bts/issue1144
+echo "===== test that verify bundle does not traceback"
+# partial history bundle, fails w/ unkown parent
+hg -R bundle.hg verify
+# full history bundle, refuses to verify non-local repo
+hg -R all.hg verify
+# but, regular verify must continue to work
+hg -R orig verify
+
+
--- a/tests/test-bundle.out	Sat Oct 18 21:11:44 2008 +0200
+++ b/tests/test-bundle.out	Sat Oct 18 14:43:14 2008 -0400
@@ -309,3 +309,11 @@
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     change foo
 
+===== test that verify bundle does not traceback
+abort: 00changelog.i@bbd179dfa0a7: unknown parent!
+abort: cannot verify bundle or remote repos
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+2 files, 2 changesets, 2 total revisions