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 (50 lines) | stat: -rw-r--r-- 1,754 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
skip_if(not existsonpath("git"))

mtn_setup()

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

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

check(mtn("add", "file1", "file2", "file3"), 0, false, false)
commit()
r1 = base_revision()
check(mtn("tag", r1, "tag1"), 0, false, false)

check(mtn("mv", "file1", "tmp"), 0, false, false)
check(mtn("mv", "file3", "file1"), 0, false, false)
check(mtn("mv", "file2", "file3"), 0, false, false)
check(mtn("mv", "tmp", "file2"), 0, false, false)
commit()
r2 = base_revision()
check(mtn("tag", r2, "tag2"), 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"))
check(samefile("mtn.dir/file3", "git.dir/file3"))

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"))
check(samefile("mtn.dir/file3", "git.dir/file3"))

-- log both repos (mainly for visual inspection)

check(indir("mtn.dir", mtn("log")), 0, false, false)
check(indir("git.dir", {"git", "log", "-M", "--summary", "-p", "--pretty=raw"}), 0, false, false)