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 (70 lines) | stat: -rw-r--r-- 2,154 bytes parent folder | download | duplicates (5)
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

mtn_setup()

remove("_MTN/log")

----------------------
--first, verify that --message-file actually works
----------------------

addfile("input.txt", "version 0 of the file")

writefile("msgfile.txt", "this commit uses the --message-file option")

check(mtn("--branch=testbranch", "commit", "--message-file=msgfile.txt"), 0, false, false)

tsha = base_revision()
check(mtn("ls", "certs", tsha), 0, true, false)
check(qgrep('this commit uses the --message-file option', "stdout"))

----------------------
--also with a file coming outside the workspace
----------------------
check(mtn("setup", "--branch=testbranch", "alt_wrk"), 0, false, false)

writefile("alt_wrk/input1.txt", "files... files...")

writefile("message-out-of-copy.txt", "out out out ")

check(indir("alt_wrk", mtn("add", "input1.txt")), 0, false, false)

check(indir("alt_wrk", mtn("--branch=outbranch", "commit", "--message-file=../message-out-of-copy.txt")), 0, false, false)

tsha = indir("alt_wrk", {base_revision})[1]()
check(indir("alt_wrk", mtn("ls", "certs", tsha)), 0, true, false)
check(qgrep('out out out', "stdout"))

-- --------------------
-- special case; --message-file='_MTN/log' is ok
-- --------------------

addfile("input3.txt", "one more file")

writefile("_MTN/log", "Log entry")

check(mtn("--branch=testbranch", "commit", "--message-file=_MTN/log"), 0, true, false)

----------------------
--start with the failures: non existing file
----------------------
addfile("input2.txt", "another file")

check(mtn("--branch=testbranch", "commit", "--message-file=to-be-or-not-to-be.txt"), 1, false, false)

----------------------
--then verify that --message and --message-file together cause an error
----------------------

check(mtn("--branch=testbranch", "commit", "--message-file=msgfile.txt",
          "--message=also a message"), 1, false, false)

-- --------------------
-- finally, --message-file and a filled _MTN/log should also fail
-- --------------------

check(get("commit_log.lua"))

writefile("_MTN/log", "Log entry")

check(mtn("--branch=testbranch", "--rcfile=commit_log.lua", "commit",
          "--message-file=msgfile.txt"), 1, false, false)