spr diff uses jujutsu to amend?
Hi everyone,
I've been using spr for the last year or so and really love it so far. As an ex-Meta source control person I've always preferred the stacked diff workflow and spr is the best tool of the lot.
I've been trying out Jujutsu version control with a colocated Git repository, and that works pretty well in conjunction with spr (since jj and spr are both about amend/rebase-based workflows). But there's a little nit I ran into, which is that spr diff, spr amend etc use git commit --amend to amend commit messages. This is okay, but essentially creates a separate commit with its own identity in jj -- jj cannot link the identities of the old and new commits.
Ideally spr would be able to run jj describe @- --stdin and feed in the message over stdin, which would avoid this problem. Would it be okay to extend spr's amending logic to use jj describe if a jujutsu repository is found?
Some ideas on the jj side of things:
- If there is a branch attached to the commit, then jj will correctly track the rewrite the next time it imports refs. I don't know what your workflow looks like, exactly, but if you could attach a branch to help jj out, then everything should work fine.
- It might be possible to create a
post-rewritehook that notifies jj about rewrites performed outside of its scope of knowledge. For example, if it piped the rewritten commits to a hypotheticaljj util record-rewrittencommand, then neither you nor spr would have to make any architectural changes to support this use-case (if I understand it correctly).
If there is a branch attached to the commit, then jj will correctly track the rewrite the next time it imports refs. I don't know what your workflow looks like, exactly, but if you could attach a branch to help jj out, then everything should work fine.
Ahh part of the point of me using jj is that I really want the anonymous heads workflow :)
I wrote some very basic support using the jj cli -- it likely needs more polish, but it works okay: https://github.com/getcord/spr/compare/master...sunshowers:spr:master