comparison tests/revlog-formatv0.py @ 12170:581066a319e5 stable

verify: fix "missing revlog!" errors for revlog format v0 and add test With revlog format v0 the .d files are empty if the only revision stored is an empty file. Since Mercurial can no longer create format v0 repositories, but still use it, add a script which creates a repository with a single empty file. This can be used in other tests if wanted.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sun, 05 Sep 2010 22:32:11 +0200
parents
children 05982f7ab231
comparison
equal deleted inserted replaced
12153:d598d24a7e67 12170:581066a319e5
1 #!/usr/bin/env python
2 # Copyright 2010 Intevation GmbH
3 # Author(s):
4 # Thomas Arendsen Hein <thomas@intevation.de>
5 #
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
8
9 """Create a Mercurial repository in revlog format 0
10
11 changeset: 0:a1ef0b125355
12 tag: tip
13 user: user
14 date: Thu Jan 01 00:00:00 1970 +0000
15 files: empty
16 description:
17 empty file
18 """
19
20 import os, sys
21
22 files = [
23 ('formatv0/.hg/00changelog.i',
24 '000000000000004400000000000000000000000000000000000000'
25 '000000000000000000000000000000000000000000000000000000'
26 '0000a1ef0b125355d27765928be600cfe85784284ab3'),
27 ('formatv0/.hg/00changelog.d',
28 '756163613935613961356635353036303562366138343738336237'
29 '61623536363738616436356635380a757365720a3020300a656d70'
30 '74790a0a656d7074792066696c65'),
31 ('formatv0/.hg/00manifest.i',
32 '000000000000003000000000000000000000000000000000000000'
33 '000000000000000000000000000000000000000000000000000000'
34 '0000aca95a9a5f550605b6a84783b7ab56678ad65f58'),
35 ('formatv0/.hg/00manifest.d',
36 '75656d707479006238306465356431333837353835343163356630'
37 '35323635616431343461623966613836643164620a'),
38 ('formatv0/.hg/data/empty.i',
39 '000000000000000000000000000000000000000000000000000000'
40 '000000000000000000000000000000000000000000000000000000'
41 '0000b80de5d138758541c5f05265ad144ab9fa86d1db'),
42 ('formatv0/.hg/data/empty.d',
43 ''),
44 ]
45
46 def makedirs(name):
47 """recursive directory creation"""
48 parent = os.path.dirname(name)
49 if parent:
50 makedirs(parent)
51 os.mkdir(name)
52
53 makedirs(os.path.join(*'formatv0/.hg/data'.split('/')))
54
55 for name, data in files:
56 f = open(name, 'wb')
57 f.write(data.decode('hex'))
58 f.close()
59
60 sys.exit(0)