mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-12 11:55:30 +00:00
a0d2112195
See `CHANGES.txt` below for the upstream-composed list of changes. `premake5.exe` built by Stan Accepted By: Stan (for Windows) Trac Tickets: #5869 Differential Revision: https://code.wildfiregames.com/D3219 This was SVN commit r24387.
70 lines
1.3 KiB
Lua
70 lines
1.3 KiB
Lua
---
|
|
-- Output a list of merged PRs since last release in the CHANGES.txt format.
|
|
---
|
|
|
|
local usage = "Usage: premake5 --file=scripts/changes.lua --since=<rev> changes"
|
|
|
|
local sinceRev = _OPTIONS["since"]
|
|
|
|
if not sinceRev then
|
|
print(usage)
|
|
error("Missing `--since`", 0)
|
|
end
|
|
|
|
|
|
local function parsePullRequestId(line)
|
|
return line:match("#%d+%s")
|
|
end
|
|
|
|
local function parseTitle(line)
|
|
return line:match("||(.+)")
|
|
end
|
|
|
|
local function parseAuthor(line)
|
|
return line:match("%s([^%s]-)/")
|
|
end
|
|
|
|
local function parseLog(line)
|
|
local pr = parsePullRequestId(line)
|
|
local title = parseTitle(line)
|
|
local author = parseAuthor(line)
|
|
return string.format("* PR %s %s (@%s)", pr, title, author)
|
|
end
|
|
|
|
|
|
local function gatherChanges()
|
|
local cmd = string.format('git log HEAD "^%s" --merges --first-parent --format="%%s||%%b"', _OPTIONS["since"])
|
|
local output = os.outputof(cmd)
|
|
|
|
changes = {}
|
|
|
|
for line in output:gmatch("[^\r\n]+") do
|
|
table.insert(changes, parseLog(line))
|
|
end
|
|
|
|
return changes
|
|
end
|
|
|
|
|
|
local function generateChanges()
|
|
local changes = gatherChanges()
|
|
table.sort(changes)
|
|
for i = 1, #changes do
|
|
print(changes[i])
|
|
end
|
|
end
|
|
|
|
|
|
newaction {
|
|
trigger = "changes",
|
|
description = "Generate list of git merges in CHANGES.txt format",
|
|
execute = generateChanges
|
|
}
|
|
|
|
newoption {
|
|
trigger = "since",
|
|
value = "revision",
|
|
description = "Log merges since this revision"
|
|
}
|
|
|