File: __driver__.lua

package info (click to toggle)
monotone 1.1-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,984 kB
  • ctags: 8,622
  • sloc: cpp: 86,450; sh: 6,906; perl: 924; makefile: 813; python: 517; lisp: 379; sql: 118; exp: 91; ansic: 52
file content (116 lines) | stat: -rw-r--r-- 2,786 bytes parent folder | download | duplicates (6)
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
-- -*-lua-*-

mtn_setup()
revs = {}

writefile("foo1", "z\na\nb\nx\n")
writefile("bar1" ,"0\n11\n2\n")
writefile("bar2", "0\n11\n22\n")

addfile("foo0", "a\nb\nc\n")
addfile("unchanged", "static\nfile\ncontents\n")
commit()
revs[0] = base_revision()

addfile("bar0", "0\n1\n2\n")
copy("foo1", "foo0")
commit()
revs[1] = base_revision()

copy("bar1", "bar0")
commit()
revs[2] = base_revision()

copy("bar2", "bar0")
commit()
revs[3] = base_revision()

-- annotate on a non-existent file gives an error
check(mtn("annotate", "nonexistent"), 1, false, false)
-- annotate on dirs gives an error
check(mtn("annotate", "."), 1, false, false)

--
-- annotate foo0 should now be
-- REV1: z
-- REV0: a
-- REV0: b
-- REV1: x

check(mtn("annotate", "--revs-only", "foo0"), 0, true, false)
check(greplines("stdout", {revs[1], revs[0], revs[0], revs[1]}))


--
-- unchanged should have all (3) lines from REV0 
--
check(mtn("annotate", "--revs-only", "unchanged"), 0, true, false)
check(greplines("stdout", {revs[0], revs[0], revs[0]}))

--
-- annotate bar0 should now be
-- REV1: 0
-- REV2: 11
-- REV3: 22

check(mtn("annotate", "--revs-only", "bar0"), 0, true, false)
check(greplines("stdout", {revs[1], revs[2], revs[3]}))


--
-- OK, now try some renames
--
check(mtn("rename", "--bookkeep-only", "foo0", "tmp"), 0, false, false)
check(mtn("rename", "--bookkeep-only", "bar0", "foo0"), 0, false, false)
check(mtn("rename", "--bookkeep-only", "tmp", "bar0"), 0, false, false)
rename("foo0", "tmp")
rename("bar0", "foo0")
rename("tmp", "bar0")
commit()
revs[4] = base_revision()

--
-- Now the previous annotate results should be reversed
--
check(mtn("annotate", "--revs-only", "bar0"), 0, true, false)
check(greplines("stdout", {revs[1], revs[0], revs[0], revs[1]}))

check(mtn("annotate", "--revs-only", "foo0"), 0, true, false)
check(greplines("stdout", {revs[1], revs[2], revs[3]}))

--
-- Try add of file on one side of branch
--

-- Making left side of fork, we won't add the file here
writefile("foo0", "foo\nnow has other data\n")
commit()
revs[5] = base_revision()

writefile("foo0", "foo\nstill has other data\n")
commit()
revs[6] = base_revision()

-- Now make right side
revert_to(revs[4])
writefile("bar0", "bar\non right side of fork\n")
commit()
revs[7] = base_revision()
addfile("forkfile", "a file\non the\nright fork\n")
commit()
revs[8] = base_revision()
writefile("forkfile", "a file\nchanged on the\nright fork\n")
commit()
revs[9] = base_revision()

check(mtn("merge"), 0, false, false)
--revs[10] = base_revision() -- how does commit create this?

-- 
-- ok, so annotate forkfile should be
-- REV8: a file
-- REV9: changed on the
-- REV8: right fork

check(mtn("annotate", "--revs-only", "forkfile"), 0, true, false)
check(greplines("stdout", {revs[8], revs[9], revs[8]}))