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
|
mtn_setup()
-- Create a single revision in branch1
--
-- root (branch1)
--
-- branch1 heads: root
revs = {}
-- like the normal commit function, except it catches the output
function local_ci(br)
check(mtn("commit", "--message=blah-blan", "--branch", br), 0, true, true)
end
writefile("f", "base data")
check(mtn("add", "f"), 0, false, false)
local_ci("branch1")
check(not qgrep('creates divergence', "stderr"))
revs.root = base_revision()
check(mtn("--branch=branch1", "heads"), 0, true, false)
check(qgrep(revs.root, "stdout"))
-- Create a child
--
-- root (branch1)
-- /
-- child1 (branch1)
--
-- branch1 heads: child1
writefile("f", "child1 data")
local_ci("branch1")
check(not qgrep('creates divergence', "stderr"))
revs.child1 = base_revision()
check(mtn("--branch=branch1", "heads"), 0, true, false)
check(not qgrep(revs.root, "stdout"))
check(qgrep(revs.child1, "stdout"))
-- Create another child
--
-- root (branch1)
-- / \
-- child1 (branch1) child2 (branch1)
--
-- branch1 heads: child1, child2
revert_to(revs.root)
writefile("f", "child2 data")
local_ci("branch1")
revs.child2 = base_revision()
check(qgrep('this revision creates divergence', "stderr"))
check(mtn("--branch=branch1", "update"), 0, false, true)
check(qgrep('has multiple heads', "stderr"))
-- Create a new branch
--
-- root (branch1)
-- / \
-- child1 (branch1) child2 (branch1)
-- /
-- new1 (branch2)
--
-- branch1 heads: child1, child2
-- branch2 heads: new2
revert_to(revs.child1)
writefile("f", "new1 data")
local_ci("branch2")
revs.new1 = base_revision()
check(not qgrep('this revision creates divergence', "stderr"))
revert_to(revs.child2)
writefile("f", "new2 data")
local_ci("branch2")
revs.new2 = base_revision()
check(qgrep('this revision creates divergence', "stderr"))
|