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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
-- acf model for displaying logfiles recusivly
module (..., package.seeall)
require("fs")
require("format")
-- no initializer in model - use controller.init for that
-- ###############################################################
-- Private functions
local function querycmd ( cmdline )
local cmd = io.popen( cmdline )
local cmd_result = cmd:read("*a") or "unknown"
cmd:close()
return cmd_result
end
-- ###############################################################
-- Public functions
get = function (self)
local svnurl = "svn://svn.alpinelinux.org/acf/"
return querycmd("/usr/bin/svn list -v " .. svnurl )
end
update = function (self)
local svnurl = "svn://svn.alpinelinux.org/acf/"
local updates = {}
local cmdresult = {}
updates.svnurl = svnurl
for list in string.gmatch((querycmd("/usr/bin/svn list " .. svnurl )), "%S+") do
local updateresult = ""
if (list == "core/") then
updateresult = querycmd("/usr/bin/svn up /usr/share/acf/ 2>&1")
elseif ( fs.is_dir("/usr/share/acf/app/" .. list)) then
updateresult = querycmd("/usr/bin/svn up /usr/share/acf/app/" .. list .. " 2>&1")
elseif (list ~= "sandbox/") then
updateresult = querycmd("/usr/bin/svn co " .. svnurl .. list .."trunk/ /usr/share/acf/app/" .. list .. " 2>&1")
end
-- Hide projects without updates
if (string.match(updateresult, "^At revision.*")) then updateresult = "" end
table.insert(cmdresult, {name=list, updates=updateresult})
end
updates.cmdresult = cmdresult
return updates
end
diffs = function (self)
local svnurl = "svn://svn.alpinelinux.org/acf/"
local updates = {}
local cmdresult = {}
updates.svnurl = svnurl
table.insert(cmdresult, {name="INFORMATION", updates="<p class=attention>Important information.</p><p>In the following output all html-brackets < and > are replaced to [ and ].<BR>This is to be able to display the diffs in text (perhibit the browser to display the diff as graphics).</p>"})
for list in string.gmatch((querycmd("/usr/bin/svn list " .. svnurl )), "%S+") do
local updateresult = ""
if (list == "core/") then
updateresult = querycmd("/usr/bin/svn -rHEAD diff /usr/share/acf/ 2>&1")
elseif ( fs.is_dir("/usr/share/acf/app/" .. list)) then
updateresult = querycmd("/usr/bin/svn -rHEAD diff /usr/share/acf/app/" .. list .. " 2>&1")
end
updateresult = format.search_replace({updateresult},"<","[")
updateresult = format.search_replace(updateresult,">","]")
updateresult = table.concat(updateresult, "\n")
table.insert(cmdresult, {name=list, updates=updateresult})
end
updates.cmdresult = cmdresult
return updates
end
status = function (self)
local svnurl = "svn://svn.alpinelinux.org/acf/"
local updates = {}
local cmdresult = {}
updates.svnurl = svnurl
for list in string.gmatch((querycmd("/usr/bin/svn list " .. svnurl )), "%S+") do
local updateresult = ""
if (list == "core/") then
updateresult = querycmd("/usr/bin/svn st -u /usr/share/acf/ 2>&1")
elseif ( fs.is_dir("/usr/share/acf/app/" .. list)) then
updateresult = querycmd("/usr/bin/svn st -u /usr/share/acf/app/" .. list .. " 2>&1")
end
-- Hide projects without diffs
if (string.match(updateresult, "^Status against revision.*")) then updateresult = "" end
table.insert(cmdresult, {name=list, updates=updateresult})
end
updates.cmdresult = cmdresult
return updates
end
|