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
|
mtn_setup()
-- Restricting a new project to a single file excludes the root directory
-- addition. The new implicit include semantics cause the root directory to
-- be included as the required parent of the specified file.
addfile("file", "file")
-- exclude newly added root dir but include file below it
-- this will implicitly include the root dir
check(mtn("st", "file"), 0, true, true)
rename("stdout", "additions")
check(grep("added", "additions"), 0, true, false)
check(numlines("stdout") == 2)
commit()
mkdir("foo")
addfile("foo/bar", "foobar")
-- exclude newly added foo dir but include bar below it
-- this will implicitly include the new foo dir and the root dir
check(mtn("st", "foo/bar"), 0, true, true)
rename("stdout", "additions")
check(grep("added", "additions"), 0, true, false)
check(numlines("stdout") == 2)
-- ensure that --depth=0 means "directory without contents" rather
-- than "directory and all immediate children"
check(mtn("st", "--depth", "0"), 0, true, false)
check(qgrep("no changes", "stdout"))
check(mtn("st", "--depth", "1"), 0, true, false)
check(qgrep("foo", "stdout"))
check(not qgrep("foo/bar", "stdout"))
check(mtn("st", "--depth", "2"), 0, true, false)
check(qgrep("foo", "stdout"))
check(qgrep("foo/bar", "stdout"))
-- ensure that --depth is relative to the current directory
chdir("foo")
check(mtn("st", ".", "--depth", "0"), 0, true, false)
check(qgrep("foo", "stdout"))
check(not qgrep("foo/bar", "stdout"))
check(mtn("st", ".", "--depth", "1"), 0, true, false)
check(qgrep("foo", "stdout"))
check(qgrep("foo/bar", "stdout"))
-- ensure that --depth is relative to the specified directory
chdir("..")
check(mtn("st", "foo", "--depth", "0"), 0, true, false)
check(qgrep("foo", "stdout"))
check(not qgrep("foo/bar", "stdout"))
check(mtn("st", "foo", "--depth", "1"), 0, true, false)
check(qgrep("foo", "stdout"))
check(qgrep("foo/bar", "stdout"))
|