1 --打开日志文件
2 svnlogPath = assert(arg[3], "路径为空");
3 svnlog = assert(io.open(svnlogPath, "r"), "打开日志文件失败!");
4
5 --日志是否为空
6 if svnlog:read(0) == nil then
7 --日志为空
8 svnlog:close();
9 io.stderr:write("请填写日志!");
10 os.exit(1);
11 else
12 --检查日志内容
13 local count = 1;
14 while true do
15 local line = svnlog:read();
16
17 if line == nil then
18 break;
19 end
20
21 --查找是否匹配
22 if string.len(line) > 0 then
23 if not string.find(line, ".:%s*%S") then
24 if not string.find(line, ".\239\188\154%s*%S") then
25 svnlog:close();
26 io.stderr:write("日志没有填写完整");
27 os.exit(1);
28 end
29 end
30 end
31
32 count = count + 1;
33 end
34
35 --检查行数是否>6行
36 if count < 6 then
37 svnlog:close();
38 io.stderr:write("请填写完整日志! ");
39 os.exit(1);
40 end
41
42 end
43
44 svnlog:close();
45