Kiln » Kiln Extensions
Clone URL:  
test-rollback.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
#!/usr/bin/env python # # Test rollback import os import common hgt = common.BfilesTester() hgt.updaterc() hgt.announce('setup') os.mkdir('repo1') os.chdir('repo1') hgt.hg(['init', '-q']) hgt.writefile('b1', 'b1') hgt.hg(['add', '--bf', 'b1']) hgt.hg(['commit', '-m', 'add bfile']) hgt.hg(['rollback'], stdout='''repository tip rolled back to revision -1 (undo commit) working directory now based on revision -1 ''') hgt.hg(['status'], stdout='''A b1 ''') hgt.hg(['commit', '-m', 'add bfile']) hgt.writefile('b2', 'b2') hgt.hg(['add', '--bf', 'b2']) hgt.hg(['commit', '-m', 'add another bfile']) hgt.hg(['rollback'], stdout='''repository tip rolled back to revision 0 (undo commit) working directory now based on revision 0 ''') hgt.hg(['status'], stdout='''A b2 ''') hgt.hg(['commit', '-m', 'add another bfile']) hgt.writefile('b2', 'b22') hgt.hg(['commit', '-m', 'modify bfile']) hgt.hg(['rollback'], stdout='''repository tip rolled back to revision 1 (undo commit) working directory now based on revision 1 ''') hgt.hg(['status'], stdout='''M b2 ''') hgt.asserttrue(hgt.readfile('b2') == 'b22', 'file changed') hgt.hg(['commit', '-m', 'modify bfile']) hgt.hg(['rm', 'b2']) hgt.hg(['commit', '-m', 'delete bfile']) hgt.hg(['rollback'], stdout='''repository tip rolled back to revision 2 (undo commit) working directory now based on revision 2 ''') hgt.hg(['status'], stdout='''! b2 ''') hgt.asserttrue(hgt.readfile('.kbf/b2') == 'ad280552ca89b1d13baa498ef352e1eabaafdf28\n', 'file changed')