Kiln » Kiln Extensions
Clone URL:  
test-remove.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/python # Test remove import os import common hgt = common.BfilesTester() def rejoin(path): '''convert unix path to local convention''' return os.path.join(*path.split('/')) # add size and patterns for adding as bfiles hgt.updaterc({'bfiles': [('size', '2'), ('patterns', 'glob:**.dat')]}) hgt.announce('setup') os.mkdir('repo1') os.chdir('repo1') hgt.hg(['init', '-q']) hgt.writefile('normal1', 'foo') os.mkdir('sub') hgt.writefile('sub/normal2', 'bar') hgt.writefile('sub/normal3.txt', 'bar2') hgt.writefile('sub/normal4.txt', 'bar3') hgt.hg(['add', '-q', 'normal1', rejoin('sub/normal2'), rejoin('sub/normal3.txt'), rejoin('sub/normal4.txt')]) hgt.hg(['commit', '-m', 'add normal files']) hgt.announce('add bfiles') hgt.writefile('big1', 'abc') hgt.writefile('sub/big2', 'xyz') hgt.writefile('sub/big3.txt', 'xyz') hgt.hg(['add', '-q', '--bf', 'big1', rejoin('sub/big2'), rejoin('sub/big3.txt')]) hgt.hg(['commit', '-m', 'added bfiles']) hgt.announce('remove sub/*.txt') hgt.hg(['remove', 'glob:sub/*.txt'], stdout=('removing sub/normal3.txt\n' 'removing sub/normal4.txt\n' 'removing sub/big3.txt\n')) hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists') hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist') hgt.hg(['status'], stdout=('R sub/big3.txt\n' 'R sub/normal3.txt\n' 'R sub/normal4.txt\n')) hgt.hg(['commit', '-m', 'remove bfiles']) hgt.announce('test update') hgt.hg(['up', '-r', '1'], stdout=('3 files updated, 0 files merged, 0 files removed, 0 files unresolved\n' 'Getting changed bfiles\n' '1 big files updated, 0 removed\n')) hgt.asserttrue(os.path.exists('sub/normal3.txt'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/normal4.txt'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/big3.txt'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist') hgt.hg(['up'], stdout=('0 files updated, 0 files merged, 3 files removed, 0 files unresolved\n' 'Getting changed bfiles\n' '0 big files updated, 1 removed\n')) hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists') hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist') hgt.announce('remove single normal files and add') hgt.hg(['remove', 'normal1', 'sub/normal2']) hgt.writefile('normal1', 'foo') hgt.writefile('sub/normal2', 'bar') hgt.hg(['add', 'normal1', 'sub/normal2']) hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists') hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist') hgt.hg(['status']) hgt.announce('remove single bfiles and add') hgt.hg(['remove', 'big1', 'sub/big2']) hgt.writefile('big1', 'abc') hgt.writefile('sub/big2', 'xyz') hgt.hg(['add', '--bf', 'big1', 'sub/big2']) hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists') hgt.asserttrue(os.path.exists('normal1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/normal2'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist') hgt.hg(['status']) hgt.announce('remove single normal files') hgt.hg(['remove', 'normal1']) hgt.hg(['remove', 'sub/normal2']) hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('normal1'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal2'), 'removed file exists') hgt.asserttrue(os.path.exists('big1'), 'added file doesnt exist') hgt.asserttrue(os.path.exists('sub/big2'), 'added file doesnt exist') hgt.hg(['status'], stdout=('R normal1\n' 'R sub/normal2\n')) hgt.announce('remove single bfiles') hgt.hg(['remove', 'big1']) hgt.hg(['remove', 'sub/big2']) hgt.assertfalse(os.path.exists('sub/normal3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal4.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/big3.txt'), 'removed file exists') hgt.assertfalse(os.path.exists('normal1'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/normal2'), 'removed file exists') hgt.assertfalse(os.path.exists('big1'), 'removed file exists') hgt.assertfalse(os.path.exists('sub/big2'), 'removed file exists') hgt.hg(['status'], stdout=('R big1\n' 'R normal1\n' 'R sub/big2\n' 'R sub/normal2\n')) hgt.hg(['commit', '-m', 'all gone']) hgt.hg(['status'])