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 (41 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download | duplicates (3)
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
skip_if(not existsonpath("patch"))

mtn_setup()

mkdir("dir")
addfile("dir/file", "foobar")
id = sha1("dir/file")

commit()

check(mtn("drop", "dir/file"), 0, false, false)
check(mtn("diff"), 0, true, false)
rename("stdout", "diff")

-- the target of a deletion should be /dev/null

check(qgrep("^--- dir/file	" .. id .. "$", "diff"))
check(qgrep("^\\+\\+\\+ /dev/null	$", "diff"))

check(mtn("revert", "dir/file"), 0, false, false)
check(exists("dir/file"))

-- patch should remove the file
-- but it is a little aggressive and removes the dir too!

copy("diff", "stdin")

-- patch from openBSD and possibly other BSDs as well
-- does not automatically drop empty files / directories, see
-- http://article.gmane.org/gmane.comp.version-control.monotone.devel/17597
if string.match(ostype, "BSD") then
    check({"patch", "-p0", "-E"}, 0, false, false, true)
    check(not exists("dir/file"))
else
    check({"patch", "-p0"}, 0, false, false, true)
    check(not exists("dir/file"))

    -- GNU patch should only remove the file but older versions may be a
    -- little aggressive and remove the dir too! We test monotone, here,
    -- so we shouldn't care whether or not "dir" still exists.
end