Debian Codegraph @

tests/revlog-formatv0.py

raw
1 #!/usr/bin/env python3
2 # Copyright 2010 Intevation GmbH
3 # Author(s):
4 # Thomas Arendsen Hein <[email protected]>
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 binascii
21 import os
22 import sys
23
24 files = [
25 (
26 b'formatv0/.hg/00changelog.i',
27 b'000000000000004400000000000000000000000000000000000000'
28 b'000000000000000000000000000000000000000000000000000000'
29 b'0000a1ef0b125355d27765928be600cfe85784284ab3',
30 ),
31 (
32 b'formatv0/.hg/00changelog.d',
33 b'756163613935613961356635353036303562366138343738336237'
34 b'61623536363738616436356635380a757365720a3020300a656d70'
35 b'74790a0a656d7074792066696c65',
36 ),
37 (
38 b'formatv0/.hg/00manifest.i',
39 b'000000000000003000000000000000000000000000000000000000'
40 b'000000000000000000000000000000000000000000000000000000'
41 b'0000aca95a9a5f550605b6a84783b7ab56678ad65f58',
42 ),
43 (
44 b'formatv0/.hg/00manifest.d',
45 b'75656d707479006238306465356431333837353835343163356630'
46 b'35323635616431343461623966613836643164620a',
47 ),
48 (
49 b'formatv0/.hg/data/empty.i',
50 b'000000000000000000000000000000000000000000000000000000'
51 b'000000000000000000000000000000000000000000000000000000'
52 b'0000b80de5d138758541c5f05265ad144ab9fa86d1db',
53 ),
54 (b'formatv0/.hg/data/empty.d', b''),
55 ]
56
57
58 def makedirs(name):
59 """recursive directory creation"""
60 parent = os.path.dirname(name)
61 if parent:
62 makedirs(parent)
63 os.mkdir(name)
64
65
66 makedirs(os.path.join(*'formatv0/.hg/data'.split('/')))
67
68 for name, data in files:
69 f = open(name, 'wb')
70 f.write(binascii.unhexlify(data))
71 f.close()
72
73 sys.exit(0)