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 (102 lines) | stat: -rw-r--r-- 3,792 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
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
skip_if(not existsonpath("git"))

mtn_setup()

writefile("author.map", "tester@test.net = other <other@test.net>\n")

writefile("file1", "file1")
writefile("file2", "file2")

check(mtn("add", "file1", "file2"), 0, false, false)
check(mtn("commit", "-m", "add file1 and file2", "-b", "branch1"), 0, false, false)
r1 = base_revision()
check(mtn("tag", r1, "tag1"), 0, false, false)

writefile("file1", "file1 has changed")
check(mtn("commit", "-m", "edit file1", "-b", "branch1"), 0, false, false)
r2 = base_revision()
check(mtn("tag", r2, "tag2"), 0, false, false)

check(mtn("update", "-r", r1), 0, false, false)

check(mtn("rm", "file2"), 0, false, false)
check(mtn("commit", "-m", "remove file2", "-b", "branch2"), 0, false, false)
r3 = base_revision()
check(mtn("tag", r3, "tag3"), 0, false, false)

check(mtn("mv", "file1", "file-one"), 0, false, false)
check(mtn("commit", "-m", "rename file1 to file-one", "-b", "branch2"), 0, false, false)
r4 = base_revision()
check(mtn("tag", r4, "tag4"), 0, false, false)

check(mtn("propagate", "branch2", "branch1"), 0, false, false)
check(mtn("update", "-r", "h:branch1"), 0, false, false)
r5 = base_revision()
check(mtn("tag", r5, "tag5"), 0, false, false)

-- export the monotone history and import it into git

mkdir("git.dir")
check(mtn("git_export", "--authors-file", "author.map"), 0, true, false)
copy("stdout", "stdin")
check(indir("git.dir", {"git", "init"}), 0, false, false)
check(indir("git.dir", {"git", "fast-import"}), 0, false, false, true)

-- check the tags we made on each rev above

check(mtn("co", "-r", "t:tag1", "mtn.dir"), 0, false, false)
check(indir("git.dir", {"git", "checkout", "tag1"}), 0, false, false)
check(samefile("mtn.dir/file1", "git.dir/file1"))
check(samefile("mtn.dir/file2", "git.dir/file2"))

remove("mtn.dir")
check(mtn("co", "-r", "t:tag2", "mtn.dir"), 0, false, false)
check(indir("git.dir", {"git", "checkout", "tag2"}), 0, false, false)
check(samefile("mtn.dir/file1", "git.dir/file1"))
check(samefile("mtn.dir/file2", "git.dir/file2"))

remove("mtn.dir")
check(mtn("co", "-r", "t:tag3", "mtn.dir"), 0, false, false)
check(indir("git.dir", {"git", "checkout", "tag3"}), 0, false, false)
check(samefile("mtn.dir/file1", "git.dir/file1"))
check(not exists("mtn.dir/file2"))
check(not exists("git.dir/file2"))

remove("mtn.dir")
check(mtn("co", "-r", "t:tag4", "mtn.dir"), 0, false, false)
check(indir("git.dir", {"git", "checkout", "tag4"}), 0, false, false)
check(samefile("mtn.dir/file-one", "git.dir/file-one"))
check(not exists("mtn.dir/file2"))
check(not exists("git.dir/file2"))

remove("mtn.dir")
check(mtn("co", "-r", "t:tag5", "mtn.dir"), 0, false, false)
check(indir("git.dir", {"git", "checkout", "tag5"}), 0, false, false)
check(samefile("mtn.dir/file-one", "git.dir/file-one"))
check(not exists("mtn.dir/file2"))
check(not exists("git.dir/file2"))

-- log both repos and check the author mapping

check(indir("mtn.dir", mtn("log")), 0, true, false)
check(qgrep("Author:   tester@test.net", "stdout"))
check(indir("git.dir", {"git", "log", "--summary", "--pretty=raw"}), 0, true, false)
check(qgrep("author other <other@test.net>", "stdout"))
check(qgrep("committer other <other@test.net>", "stdout"))

-- check branch refs

remove("mtn.dir")
check(mtn("co", "-r", "h:branch2", "mtn.dir"), 0, false, false)
check(indir("git.dir", {"git", "checkout", "branch2"}), 0, false, false)
check(samefile("mtn.dir/file-one", "git.dir/file-one"))
check(not exists("mtn.dir/file2"))
check(not exists("git.dir/file2"))

remove("mtn.dir")
check(mtn("co", "-r", "h:branch1", "mtn.dir"), 0, false, false)
check(indir("git.dir", {"git", "checkout", "branch1"}), 0, false, false)
check(samefile("mtn.dir/file-one", "git.dir/file-one"))
check(not exists("mtn.dir/file2"))
check(not exists("git.dir/file2"))