-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(jj): add module for Jujutsu current change ID #5814
base: master
Are you sure you want to change the base?
Conversation
a02ad4f
to
15b298e
Compare
15b298e
to
73abfbb
Compare
I see #5772 exists, it uses the approach of computing everything at once and only displaying the wanted elements, I'm not sure which starship prefers |
I'd strongly prefer the jj calls would have Not snapshotting works fine for change ids and branches, for diffs you'd either give up and do snapshots or wait for edit: well that other PR does this and more, oh well :) |
73abfbb
to
dea3945
Compare
[Jujutsu](https://github.com/martinvonz/jj) is a new VCS that is change-based. I want to do several PRs to add various parts of its informations to starship, starting with the simplest one, the current change ID.
dea3945
to
c9cec66
Compare
@necauqua you're right, and I also added the The step has gone from 48ms before to 35ms with those |
Would love to also be able to indicate whether the change is empty or missing a description. Thanks! Happy to help move this along... |
match root.is_empty() { | ||
true => None, | ||
false => Some(Box::from(root)), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match root.is_empty() { | |
true => None, | |
false => Some(Box::from(root)), | |
} | |
(!root.is_empty()).then_some(Box::from(root)) |
let current_jj_change = { | ||
let template = format!("change_id.shortest({})", config.change_id_length); | ||
let out = context.exec_cmd( | ||
"jj", | ||
&[ | ||
"--repository", | ||
root, | ||
"log", | ||
"--color", | ||
"never", | ||
"--revisions", | ||
"@", // Only display the current revision | ||
"--no-graph", | ||
"--template", | ||
&template, | ||
"--ignore-working-copy", | ||
], | ||
)?; | ||
out.stdout.lines().next().map(ToString::to_string)? | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer moving this into the map
pub fn get_jj_repo(&self) -> Option<&str> { | ||
self.jj_repo | ||
.get_or_init(|| { | ||
let out = self.exec_cmd("jj", &["root", "--ignore-working-copy"])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to do begin_ancestor_scan
first for better performance.
Description
Adds support for getting and displaying the current Jujutsu change ID (when in a Jujutsu repo)
Motivation and Context
Jujutsu is a new VCS that is change-based.
I want to do several PRs to add various parts of its informations to starship, starting with the simplest one, the current change ID.
Screenshots (if appropriate):
Explained prompt, with the JJ change ID module:
Result of explained prompt above:
How Has This Been Tested?
Checklist: