File: __driver__.lua

package info (click to toggle)
monotone 0.31-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 20,680 kB
  • ctags: 14,801
  • sloc: cpp: 87,711; ansic: 64,862; sh: 5,691; lisp: 954; perl: 783; makefile: 509; python: 265; sql: 98; sed: 16
file content (49 lines) | stat: -rw-r--r-- 2,015 bytes parent folder | download
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

mtn_setup()

-- possible problems:
--   -- the new root doesn't exist
--   -- the new root is not a dir
--   -- the new root has an _MTN in it
--   -- the directory the old root is supposed to end up in doesn't exist
--   -- the directory the old root is supposed to end up in is not a directory
--   -- the directory the old root is supposed to end up in already
--      contains something with the given name
-- then make sure --execute puts things in the right place...

mkdir("workspace")
check(indir("workspace", mtn("setup", ".", "-b", "testbranch")), 0, false, false)

mkdir("workspace/dir1")
mkdir("workspace/dir1/dir2")
writefile("workspace/dir1/file1", "blah blah")
mkdir("workspace/dir3")
mkdir("workspace/dir3/_MTN")
check(indir("workspace", mtn("add", "-R", ".")), 0, false, false)

check(indir("workspace", mtn("commit", "-m", "foo")), 0, false, false)

check(indir("workspace", mtn("pivot_root", "nosuchdir", "foo")), 1, false, false)
check(indir("workspace", mtn("pivot_root", "dir1/file1", "foo")), 1, false, false)
check(indir("workspace", mtn("pivot_root", "dir3", "old_root")), 1, false, false)
check(indir("workspace", mtn("pivot_root", "dir1", "nosuchdir/old_root")), 1, false, false)
check(indir("workspace", mtn("pivot_root", "dir1", "file1/old_root")), 1, false, false)
check(indir("workspace", mtn("pivot_root", "dir1", "dir2")), 1, false, false)

check(indir("workspace", mtn("ls", "changed")), 0)
check(indir("workspace", mtn("ls", "missing")), 0)
check(indir("workspace", mtn("ls", "unknown")), 0)

check(indir("workspace", mtn("pivot_root", "--execute", "dir1", "old_root")), 0, false, false)

check(isdir("workspace/_MTN"))
check(isdir("workspace/dir2"))
check(exists("workspace/file1"))
check(isdir("workspace/old_root"))
check(isdir("workspace/old_root/dir3"))
check(isdir("workspace/old_root/dir3/_MTN"))

check(indir("workspace", mtn("ls", "missing")), 0)
check(indir("workspace", mtn("ls", "unknown")), 0)

check(indir("workspace", mtn("commit", "-m", "foo")), 0, false, false)