Kiln » Kiln Extensions
Clone URL:  
test-archive.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/python # Test various tricky bfadd corner cases. import os import common hgt = common.BfilesTester() hgt.updaterc() hgt.announce('setup') os.mkdir('repo1') os.chdir('repo1') hgt.hg(['init']) hgt.writefile('normal1', 'foo') os.mkdir('sub') hgt.writefile('sub/normal2', 'bar') hgt.writefile('big1', 'abc') hgt.writefile('sub/big2', 'xyz') hgt.hg(['add', 'normal1', 'sub/normal2']) hgt.hg(['add', '--bf', 'big1', 'sub/big2']) hgt.hg(['commit', '-m', 'add files']) hgt.writefile('normal1', 'foo1') hgt.writefile('sub/normal2', 'bar1') hgt.writefile('big1', 'abc1') hgt.writefile('sub/big2', 'xyz1') hgt.hg(['commit', '-m', 'edit files']) hgt.hg(['rm', 'normal1', 'big1']) hgt.hg(['commit', '-m', 'remove files']) hgt.hg(['mv', 'sub/normal2', 'normal1']) hgt.hg(['mv', 'sub/big2', 'big1']) hgt.hg(['commit', '-m', 'move files']) hgt.hg(['cp', 'normal1', 'sub/normal2']) hgt.hg(['cp', 'big1', 'sub/big2']) hgt.hg(['commit', '-m', 'copy files']) hgt.hg(['archive', '-r', '0', '../archive0']) hgt.hg(['archive', '-r', '1', '../archive1']) hgt.hg(['archive', '-r', '2', '../archive2']) hgt.hg(['archive', '-r', '3', '../archive3']) hgt.hg(['archive', '-r', '4', '../archive4']) os.chdir('../archive0') hgt.asserttrue(hgt.readfile('normal1') == 'foo', 'contents dont match') hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar', 'contents dont match') hgt.asserttrue(hgt.readfile('big1') == 'abc', 'contents dont match') hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz', 'contents dont match') os.chdir('../archive1') hgt.asserttrue(hgt.readfile('normal1') == 'foo1', 'contents dont match') hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar1', 'contents dont match') hgt.asserttrue(hgt.readfile('big1') == 'abc1', 'contents dont match') hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz1', 'contents dont match') os.chdir('../archive2') hgt.asserttrue(not os.path.exists('normal1'), 'file should not exist') hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar1', 'contents dont match') hgt.asserttrue(not os.path.exists('big1'), 'file should not exist') hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz1', 'contents dont match') os.chdir('../archive3') hgt.asserttrue(not os.path.exists('sub/normal2'), 'file should not exist') hgt.asserttrue(hgt.readfile('normal1') == 'bar1', 'contents dont match') hgt.asserttrue(not os.path.exists('sub/big2'), 'file should not exist') hgt.asserttrue(hgt.readfile('big1') == 'xyz1', 'contents dont match') os.chdir('../archive4') hgt.asserttrue(hgt.readfile('normal1') == 'bar1', 'contents dont match') hgt.asserttrue(hgt.readfile('sub/normal2') == 'bar1', 'contents dont match') hgt.asserttrue(hgt.readfile('big1') == 'xyz1', 'contents dont match') hgt.asserttrue(hgt.readfile('sub/big2') == 'xyz1', 'contents dont match')