How to efficiently query dependencies for all changes?

I’m trying to generate a graph of all changes present in a repository and the dependencies between them. I’m only aware of pijul change, but forking a separate process for every single change will most likely become too expensive for large repositories. Is there some single command to query the dependencies for all changes at once? I would have expected some option to pijul log, but couldn’t find any.

-Marc

The dependencies for all changes are exactly the changes that are returned by pijul log. So, likely, that is not what you want to have.

So, what is it you actually want to know? Do you look for the dependency graph, maybe?

Right, I’m looking for the dependency graph (in JSON format, not rendered as graph) which comprises exactly those dependencies which are reported by pijul change, in # Dependencies section, including the dependency-type (normal vs. + vs. *).

In terms of Git, I’m looking for git log --format=raw.

-Marc

That does not exist, yet. The principle functionality is there and can be seen with pijul log --output-format json. It is not yet integrated into pijul change, though.

Thanks. IMHO, the most intuitive solution to provide these dependencies would be an additional option for pijul log. It already has nice pagination with --limit and --offset and offers --json, so it’s quite flexible. A more low-level approach might be to have pijul change to accept a list of hashes and optionally output in a machine-parsable format, probably JSON for consistency with the other commands.

Does any of the above sound more reasonable than the other (also taking into account technical considerations)? I’d then file a discussion/RFE for that.

Btw, in the meanwhile I have experimented with a combination of a single pijul log --hash-only and one pijul change per hash. On Windows, for pijul/pijul, doing this entire query requires ~170 seconds for 765 changes.

-Marc

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 'size = 15;'
echo 'overlap = scale;'

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 );
	print "\"" substr(oid,0,idlen) "\" [tooltip=\"" 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.