BEGIN { FS = ": " rcount = 0 } { sub(/^( )*/,"",$0) } /^revno:/{revno = $2; rs[++rcount] = $2} /^revision-id:/{ revids[$2] = revno revnos[revno,"revid"] = $2 revnos[revno,"parents"] = 0 } /^parent:/{revnos[revno,"parent",++revnos[revno,"parents"]] = $2} /^committer:/{revnos[revno,"committer"] = $2} /^branch nick:/{revnos[revno,"branch"] = $2} /^timestamp:/{revnos[revno,"time"] = $2} /^ .*/{revnos[revno,"message"] = revnos[revno,"message"] $0 "\n"} function mangle(s) { gsub(/@/, "_at_", s) gsub(/\./, "_dot_", s) return s } END{ for (r=1; r<=rcount; r++) { revno = rs[r] print ".. _"revno":\n" if((revno,"branch") in revnos) { into = "into branch ``"revnos[revno,"branch"]"`` " } else { into = "" } print "* rev. **"revno"** by *"mangle(revnos[revno,"committer"])"* "into"at "revnos[revno,"time"] for (n=1; n <= revnos[revno,"parents"]; n++) { p_revid = revnos[revno,"parent",n] rev_range=revnos[revno,"revid"]".."p_revid gsub(/[:%/?*]/, "_", rev_range) print "* parent: `"revids[p_revid]"`_ `diff `__" } print "\n::\n\n" revnos[revno,"message"] } }