##// END OF EJS Templates
tests: port helper script revlog-formatv0.py to python 3...
Augie Fackler -
r36583:9805c906 default
parent child Browse files
Show More
@@ -1,62 +1,63 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # Copyright 2010 Intevation GmbH
2 # Copyright 2010 Intevation GmbH
3 # Author(s):
3 # Author(s):
4 # Thomas Arendsen Hein <thomas@intevation.de>
4 # Thomas Arendsen Hein <thomas@intevation.de>
5 #
5 #
6 # This software may be used and distributed according to the terms of the
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.
7 # GNU General Public License version 2 or any later version.
8
8
9 """Create a Mercurial repository in revlog format 0
9 """Create a Mercurial repository in revlog format 0
10
10
11 changeset: 0:a1ef0b125355
11 changeset: 0:a1ef0b125355
12 tag: tip
12 tag: tip
13 user: user
13 user: user
14 date: Thu Jan 01 00:00:00 1970 +0000
14 date: Thu Jan 01 00:00:00 1970 +0000
15 files: empty
15 files: empty
16 description:
16 description:
17 empty file
17 empty file
18 """
18 """
19
19
20 from __future__ import absolute_import
20 from __future__ import absolute_import
21 import binascii
21 import os
22 import os
22 import sys
23 import sys
23
24
24 files = [
25 files = [
25 (b'formatv0/.hg/00changelog.i',
26 (b'formatv0/.hg/00changelog.i',
26 b'000000000000004400000000000000000000000000000000000000'
27 b'000000000000004400000000000000000000000000000000000000'
27 b'000000000000000000000000000000000000000000000000000000'
28 b'000000000000000000000000000000000000000000000000000000'
28 b'0000a1ef0b125355d27765928be600cfe85784284ab3'),
29 b'0000a1ef0b125355d27765928be600cfe85784284ab3'),
29 (b'formatv0/.hg/00changelog.d',
30 (b'formatv0/.hg/00changelog.d',
30 b'756163613935613961356635353036303562366138343738336237'
31 b'756163613935613961356635353036303562366138343738336237'
31 b'61623536363738616436356635380a757365720a3020300a656d70'
32 b'61623536363738616436356635380a757365720a3020300a656d70'
32 b'74790a0a656d7074792066696c65'),
33 b'74790a0a656d7074792066696c65'),
33 (b'formatv0/.hg/00manifest.i',
34 (b'formatv0/.hg/00manifest.i',
34 b'000000000000003000000000000000000000000000000000000000'
35 b'000000000000003000000000000000000000000000000000000000'
35 b'000000000000000000000000000000000000000000000000000000'
36 b'000000000000000000000000000000000000000000000000000000'
36 b'0000aca95a9a5f550605b6a84783b7ab56678ad65f58'),
37 b'0000aca95a9a5f550605b6a84783b7ab56678ad65f58'),
37 (b'formatv0/.hg/00manifest.d',
38 (b'formatv0/.hg/00manifest.d',
38 b'75656d707479006238306465356431333837353835343163356630'
39 b'75656d707479006238306465356431333837353835343163356630'
39 b'35323635616431343461623966613836643164620a'),
40 b'35323635616431343461623966613836643164620a'),
40 (b'formatv0/.hg/data/empty.i',
41 (b'formatv0/.hg/data/empty.i',
41 b'000000000000000000000000000000000000000000000000000000'
42 b'000000000000000000000000000000000000000000000000000000'
42 b'000000000000000000000000000000000000000000000000000000'
43 b'000000000000000000000000000000000000000000000000000000'
43 b'0000b80de5d138758541c5f05265ad144ab9fa86d1db'),
44 b'0000b80de5d138758541c5f05265ad144ab9fa86d1db'),
44 (b'formatv0/.hg/data/empty.d',
45 (b'formatv0/.hg/data/empty.d',
45 b''),
46 b''),
46 ]
47 ]
47
48
48 def makedirs(name):
49 def makedirs(name):
49 """recursive directory creation"""
50 """recursive directory creation"""
50 parent = os.path.dirname(name)
51 parent = os.path.dirname(name)
51 if parent:
52 if parent:
52 makedirs(parent)
53 makedirs(parent)
53 os.mkdir(name)
54 os.mkdir(name)
54
55
55 makedirs(os.path.join(*'formatv0/.hg/data'.split('/')))
56 makedirs(os.path.join(*'formatv0/.hg/data'.split('/')))
56
57
57 for name, data in files:
58 for name, data in files:
58 f = open(name, 'wb')
59 f = open(name, 'wb')
59 f.write(data.decode('hex'))
60 f.write(binascii.unhexlify(data))
60 f.close()
61 f.close()
61
62
62 sys.exit(0)
63 sys.exit(0)
General Comments 0
You need to be logged in to leave comments. Login now