File: test.lua

package info (click to toggle)
lua-svn 0.4.0-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 244 kB
  • ctags: 201
  • sloc: ansic: 1,337; makefile: 21
file content (45 lines) | stat: -rw-r--r-- 1,063 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
svn = require "svn"

repo_path = "test_repo"
repo_url = "file://"..os.getenv("PWD").."/test_repo"
test_path = "test"
file_name = "test.file"
dir_name = "trunk"

dir = test_path.."/"..dir_name
file = dir .. "/" .. file_name
contents = { "content1", "content2" }
rev2content = {}

svn.repos_create(repo_path)
assert(svn.checkout(repo_url, test_path), "unable to checkout")
svn.mkdir(dir)
f = io.open(file,"w")
f:write(contents[1])
f:close()
svn.add(file)
t = svn.status(file)
assert(string.sub(t[file],1,1) == "A", "file not correctly added: "..t[file])
r1 = svn.commit(test_path)
rev2content[r1] = contents[1]
f = io.open(file,"w")
f:write(contents[2])
f:close()
t = svn.status(file)
assert(string.sub(t[file],1,1) == "M", "file not listed as modified")
r2 = svn.commit(file)
rev2content[r2]=contents[2]
t = svn.list(repo_url)
for k in pairs(t) do
	print(k)
end
h = svn.log (file)
for rev, v in pairs(h) do
	assert(svn.cat(file, rev) == rev2content[rev])
	print(rev)
	for k,v in pairs(v) do
		print(k,v)
	end
end
svn.cleanup(test_path)
svn.repos_delete(repo_path)