--- orig/tla-file-log +++ mod/tla-file-log @@ -8,17 +8,18 @@ test "$#" = 1 || { echo 1>&2 "Usage: $me FILE"; exit 1; } test -d {arch} || { echo 1>&2 "$me: Not in an arch project tree"; exit 2; } -for V in `tla logs`; do - for R in `tla log-ls -f $V`; do - echo "@@@" - tla cat-log $R - done +FILE="$1" + +for REV in `tla logs | xargs -r tla log-ls -f`; do + echo "@@@" + tla cat-log "$REV" done | nawk ' BEGIN { - file = "'"$1"'" + file = "'"$FILE"'" sub (/^\.\//, "", file) reset() } + function reset() { matches = 0 @@ -26,7 +27,8 @@ in_hdrs = 1 hdr_cont = 0 } -function scan_hdr(first_field, possible_action ,fn) + +function scan_hdr(first_field, possible_action ,fn,mf) { for (fn = first_field; fn <= NF; fn++) { mf = $fn @@ -37,24 +39,30 @@ action = possible_action } } + hdr_cont = 1 } + function hdr_text( txt) { txt = substr ($0, length ($1) + 1) sub (/^ */, "", txt) return txt } + /^@@@$/ { reset(); next } + in_hdrs && /^Revision:/ { revision = hdr_text(); next } in_hdrs && /^Archive:/ { archive = hdr_text(); next } in_hdrs && /^Creator:/ { creator = hdr_text(); next } in_hdrs && /^Summary: *[^ ]/ { summary = hdr_text(); next } in_hdrs && /^Standard-date: *[^ ]/ { date = hdr_text(); next } -in_hdrs && /^Modified-files:/ { hdr_cont = 1; scan_hdr(2, 0); next } -in_hdrs && /^(New-files:|New-directories:)/ { hdr_cont = 1; scan_hdr(2, "added"); next } -in_hdrs && /^(Removed-files:|Removed-directories:)/ { hdr_cont = 1; scan_hdr(2, "removed"); next } -in_hdrs && /^(Renamed-files:|Renamed-directories:)/ { hdr_cont = 1; scan_hdr(2, "renamed"); next } + +in_hdrs && /^Modified-files:/ { scan_hdr(2, 0); next } +in_hdrs && /^New-(files|directories):/ { scan_hdr(2, "added"); next } +in_hdrs && /^Removed-(files|directories):/ { scan_hdr(2, "removed"); next } +in_hdrs && /^Renamed-(files|directories):/ { scan_hdr(2, "renamed"); next } hdr_cont && /^[ ]/ { scan_hdr(1); next } + in_hdrs && /^$/ { in_hdrs = 0 if (matches) { @@ -71,6 +79,7 @@ next } in_hdrs { hdr_cont = 0; next } + { if (matches) print } '