
mtn_setup()

writefile("testfile0", "version 0 of first test file")

check(mtn("add", "testfile0"), 0, false, false)
v1 = sha1("testfile0")
commit()

writefile("foofile0", "squirrils monkeys dingos")
check(mtn("rename", "--bookkeep-only", "testfile0", "foofile0"), 0, false, false)
check(qgrep("testfile0", "_MTN/revision"))
check(qgrep("foofile0", "_MTN/revision"))
check(mtn("status"), 0, true)
check(qgrep("testfile0", "stdout"))
check(qgrep("foofile0", "stdout"))
check(mtn("revert", "foofile0"), 0, false, false)
check(not qgrep("testfile0", "_MTN/revision"))
check(not qgrep("foofile0", "_MTN/revision"))
check(mtn("status"), 0, true)
check(not qgrep("testfile0", "stdout"))
check(not qgrep("foofile0", "stdout"))

writefile("foofile0", "squirrils monkeys dingos")
check(mtn("rename", "--bookkeep-only", "testfile0", "foofile0"), 0, false, false)
check(qgrep("testfile0", "_MTN/revision"))
check(qgrep("foofile0", "_MTN/revision"))
check(mtn("status"), 0, true)
check(qgrep("testfile0", "stdout"))
check(qgrep("foofile0", "stdout"))
check(mtn("revert", "testfile0"), 0, false, false)
check(v1 == sha1("testfile0"))
check(not qgrep("testfile0", "_MTN/revision"))
check(not qgrep("foofile0", "_MTN/revision"))
check(mtn("status"), 0, true)
check(not qgrep("testfile0", "stdout"))
check(not qgrep("foofile0", "stdout"))
