How to efficiently query dependencies for all changes?

I was looking for this also, so I saw a script saved in a change on one of the Pijul discussions. It has some redundant code, so once I reduced it, it’s a lot like what you describe

combination of a single pijul log --hash-only and one pijul change per hash

Here is my version of that script:

#!/bin/bash
LEN=10

(
echo 'digraph PCG {'
echo 'ratio=fill;'
echo 'size=10;'
echo 'overlap=scale;'
echo 'node [shape=rect target="_blank"];'

pijul log --hash-only "$@" | while read ID; do
    pijul change "$ID" | awk -v oid="$ID" -v idlen="$LEN" '
/^message =/ { msg = substr($0, index($0, $3));
	gsub( /"/, "", msg );
	if (length(msg) > idlen*2) {
		gsub(/([^ ]+ ){3,4}/, "&\\\n", msg);
	}
	print "\"" substr(oid,0,idlen) "\" [label=\"" substr(oid,0,idlen) "\\n" msg "\"];"; }    
$1 == "#" {
    section = $2;
}
$1 != "#" && $2 != "" && section == "Dependencies" && $1 != "[*]" && substr($1,length($1),1) != "+" {
    print "\"" substr(oid,0,idlen) "\" -> \"" substr($2,0,idlen) "\";";
}
'
done
echo '}'
)  | dot -Tsvg /dev/stdin -o /dev/stdout

I run it on Ubuntu on the pijul repo and it takes 28 seconds to output the text file for the graph of 807 changes. Generating the SVG from the graph takes longer, but it needs better parameters because the changes are so interdependent that you can’t read it.

Since my goal was to unrecord, I found two things:

  1. unrecord says “A change can only be unrecorded if all changes that depend on it are also unrecorded in the same operation.”
    There seems to be no way to get a list of changes that depend on one change.
  2. When you do pijul unrecord --show-changes, you get what the log would show if it showed dependencies. So it looks like that code is written already, but inaccessible for a graph since this option puts it into interactive mode.