Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spr diff uses jujutsu to amend? #182

Open
sunshowers opened this issue Nov 8, 2023 · 4 comments
Open

spr diff uses jujutsu to amend? #182

sunshowers opened this issue Nov 8, 2023 · 4 comments

Comments

@sunshowers
Copy link

sunshowers commented Nov 8, 2023

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?

@arxanas
Copy link

arxanas commented Nov 10, 2023

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-rewrite hook that notifies jj about rewrites performed outside of its scope of knowledge. For example, if it piped the rewritten commits to a hypothetical jj util record-rewritten command, then neither you nor spr would have to make any architectural changes to support this use-case (if I understand it correctly).

@sunshowers
Copy link
Author

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 :)

@sunshowers
Copy link
Author

sunshowers commented Feb 9, 2024

I wrote some very basic support using the jj cli -- it likely needs more polish, but it works okay: master...sunshowers:spr:master

@sunshowers
Copy link
Author

^ I've been using the above for the last 4 months and it's been fine. Pretty good even!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants