cli: make jj st show parent commit before working copy commit

Perhaps it makes more sense to display the working copy commit just
above the changes in the working copy commit, even though that means
that the order between the working copy commit and the parent becomes
the opposite of the order in `jj log`.
This commit is contained in:
Martin von Zweigbergk 2021-05-23 22:08:37 -07:00
parent ba8ff31e32
commit 080a9b37ff
2 changed files with 7 additions and 7 deletions

View file

@ -1117,12 +1117,12 @@ fn cmd_status(
let mut repo_command = command.repo_helper(ui)?;
let commit = repo_command.commit_working_copy();
let repo = repo_command.repo();
ui.write("Working copy : ")?;
ui.write_commit_summary(repo.as_repo_ref(), &commit)?;
ui.write("\n")?;
ui.write("Parent commit: ")?;
ui.write_commit_summary(repo.as_repo_ref(), &commit.parents()[0])?;
ui.write("\n")?;
ui.write("Working copy : ")?;
ui.write_commit_summary(repo.as_repo_ref(), &commit)?;
ui.write("\n")?;
let summary = commit.parents()[0].tree().diff_summary(&commit.tree());
if summary.is_empty() {
ui.write("The working copy is clean\n")?;

View file

@ -28,8 +28,8 @@ fn smoke_test() {
assert_eq!(output.status, 0);
let stdout_string = output.stdout_string();
let output_regex = Regex::new(
"^Working copy : ([[:xdigit:]]+) \n\
Parent commit: 000000000000 \n\
"^Parent commit: 000000000000 \n\
Working copy : ([[:xdigit:]]+) \n\
The working copy is clean\n\
$",
)
@ -56,8 +56,8 @@ fn smoke_test() {
assert_eq!(output.status, 0);
let stdout_string = output.stdout_string();
let output_regex = Regex::new(
"^Working copy : ([[:xdigit:]]+) \n\
Parent commit: 000000000000 \n\
"^Parent commit: 000000000000 \n\
Working copy : ([[:xdigit:]]+) \n\
Working copy changes:\n\
A file1\n\
A file2\n\