File: __driver__.lua

package info (click to toggle)
monotone 1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 20,708 kB
  • sloc: cpp: 84,765; sh: 6,787; perl: 837; makefile: 833; python: 517; lisp: 379; sql: 118; exp: 88; ansic: 52
file content (96 lines) | stat: -rw-r--r-- 3,516 bytes parent folder | download | duplicates (4)
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
-- Test 'undrop' command
-- fixes bug#13604

mtn_setup()

addfile("changed", "base")
commit()

-- With no changes before 'drop', 'undrop' is just 'revert'
check(mtn("drop", "changed"), 0, false, false)
check(mtn("undrop", "changed"), 0, false, false)
check(readfile("changed")=="base")

check(mtn("status"), 0, true, false)
check(qgrep("no changes", "stdout"))

-- With changes before 'drop', 'undrop' is like 'revert --bookkeeponly'
writefile("changed", "modified")
check(mtn("drop", "changed"), 0, false, true)
check(qgrep("file 'changed' changed - it will be dropped but not deleted", "stderr"))
check(mtn("undrop", "changed"), 0, false, false)
check(readfile("changed")=="modified")
check(mtn("status"), 0, true, false)
check(qgrep("patched  changed", "stdout"))

-- one changed, one unchanged file
addfile("unchanged", "base")
writefile("changed", "base")
commit()

writefile("changed", "modified")
check(mtn("drop", "changed", "unchanged"), 0, false, true)
check(qgrep("file 'changed' changed - it will be dropped but not deleted", "stderr"))
check(qgrep("dropping 'unchanged' from workspace", "stderr"))
check(mtn("undrop", "changed", "unchanged"), 0, false, false)
check(readfile("changed")=="modified")
check(readfile("unchanged")=="base")
check(mtn("status"), 0, true, false)
check(qgrep("patched  changed", "stdout"))
check(not qgrep("patched  unchanged", "stdout"))

-- drop undrop directory with a changed file
mkdir("dir1")
addfile("dir1/file1", "file1")
addfile("dir1/file2", "file2")
writefile("changed", "base")
commit()

writefile("dir1/file1", "file1-changed")
check(mtn("drop", "--recursive", "dir1"), 0, false, true)
check(qgrep("file 'dir1/file1' changed - it will be dropped but not deleted", "stderr"))
check(qgrep("directory 'dir1' not empty - it will be dropped but not deleted", "stderr"))
check(qgrep("dropping 'dir1/file2' from workspace", "stderr"))
check(qgrep("dropping 'dir1' from workspace", "stderr"))

check(mtn("undrop", "dir1"), 0, false, true)
check(readfile("dir1/file1")=="file1-changed")
check(readfile("dir1/file2")=="file2")
check(mtn("status"), 0, true, false)
check(qgrep("patched  dir1/file1", "stdout"))

-- drop undrop directory with no changed file
writefile("dir1/file1", "file1")

check(mtn("drop", "--recursive", "dir1"), 0, false, true)
check(qgrep("dropping 'dir1/file1' from workspace", "stderr"))
check(qgrep("dropping 'dir1/file2' from workspace", "stderr"))
check(qgrep("dropping 'dir1' from workspace", "stderr"))

check(mtn("undrop", "dir1"), 0, false, true)
check(readfile("dir1/file1")=="file1")
check(readfile("dir1/file2")=="file2")
check(mtn("status"), 0, true, false)
check(qgrep("no changes", "stdout"))

-- file that was not dropped. 'revert' doesn't report an error for
-- this, so 'undrop' doesn't either.
check(mtn("undrop", "unchanged"), 0, false, false)

-- drop a directory without --recursive gives an error, so 'undrop --recursive' is redundant
check(mtn("drop", "dir1"), 1, false, true)
check(qgrep("cannot remove 'dir1/', it is not empty", "stderr"))

-- File that was dropped and committed cannot be undropped
check(mtn("drop", "changed"), 0, false, false)
commit()

check(mtn("undrop", "changed"), 1, false, true)
check(qgrep("1 unknown path", "stderr"))

-- Undrop a child of a directory that was dropped
check(mtn("drop", "--recursive", "dir1"), 0, false, true)
check(mtn("undrop", "dir1/file1"), 1, false, true)
check(qgrep("restriction excludes addition of 'dir1' but includes addition of 'dir1/file1'", "stderr"))

-- end of file