forked from SolarStrike-Software/rom-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svnupdate.lua
56 lines (46 loc) · 1.51 KB
/
svnupdate.lua
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
--[[
Options:
revert - Remove all changes made by the user before attempting an SVN update
]]
function checkout()
warning("TortoiseSVN has not been configured for this path yet. You must do so now.");
local path = getExecutionPath();
local cmd = sprintf("TortoiseProc /command:checkout /path:\"%s\" /url:http://rom-bot.googlecode.com/svn/trunk/rom", path);
system(cmd);
local msg = sprintf("Completed SVN checkout.");
printf("%s\n", msg);
logMessage(msg);
end
function update(options)
local path = getExecutionPath();
local msg = sprintf("Attempting SVN update of path \'%s\'", path);
printf("%s\n", msg);
logMessage(msg);
if( options.revert ) then
-- Revert any changes first
warning("Reverting user changes...");
local cmd = sprintf("TortoiseProc /command:revert /path:\"%s\"", path);
system(cmd);
end
local cmd = sprintf("TortoiseProc /command:update /path:\"%s\" /notempfile /closeonend:2", path);
system(cmd);
end
function main()
local options = {
revert = false;
};
for i,v in pairs(args) do
if( v == "revert" ) then
options.revert = true;
end
end
if( not allowSystemCommands ) then
error("You must allow system commands in your config file in order to use this script.", 0);
end
if( not getDirectory(getExecutionPath() .. "/.svn") ) then
checkout(); -- Configure the directory for TortoiseSVN
end
update(options); -- Perform an SVN update
printf("Finished. You should now be up-to-date (if no error occured).\n");
end
main();