1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

mfc-candidates: move pretty printing into lua

d51c590023 moved the MFC hash matching logic into a lua utility
script but left the output formatting in the shell script. Simplify this
slightly by just printing the formatted output from lua.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44836
This commit is contained in:
Ed Maste 2024-04-16 12:49:05 -04:00
parent b9827c007a
commit 793745fad8
2 changed files with 10 additions and 7 deletions

View File

@ -36,6 +36,14 @@ local function set_difference(set1, set2)
return result
end
-- Execute a command and print to stdout
local function exec_command(command)
local handle = io.popen(command)
local output = handle:read("a")
handle:close()
io.write(output)
end
-- Main function
local function main()
local from_file = arg[1]
@ -59,7 +67,7 @@ local function main()
-- Print the result
for _, hash in ipairs(result_hashes) do
print(hash)
exec_command("git show --pretty='%h %s' --no-patch " .. hash)
end
end

View File

@ -152,7 +152,6 @@ canonicalize_hashes()
workdir=$(mktemp -d /tmp/find-mfc.XXXXXXXXXX)
from_list=$workdir/commits-from
to_list=$workdir/commits-to
candidate_list=$workdir/candidates
if [ -n "$exclude_file" ]; then
exclude_list=$workdir/commits-exclude
@ -163,10 +162,6 @@ commits_from "$@" > $from_list
commits_to "$@" > $to_list
/usr/libexec/flua $(dirname $0)/candidatematch.lua \
$from_list $to_list $exclude_list > $candidate_list
while read hash; do
git show --pretty='%h %s' --no-patch $hash
done < $candidate_list
$from_list $to_list $exclude_list
rm -rf "$workdir"