forked from mirrors/jj
cli: abbreviate operation id embedded in warning/error messages
Operation id is quite long and these messages looked noisy with the full hash.
This commit is contained in:
parent
e5da4df243
commit
51cb4d901c
1 changed files with 10 additions and 6 deletions
|
@ -621,8 +621,8 @@ impl WorkspaceCommandHelper {
|
|||
ui,
|
||||
"The working copy is stale (not updated since operation {}), now updating \
|
||||
to operation {}",
|
||||
wc_operation.id().hex(),
|
||||
repo_operation.id().hex()
|
||||
short_operation_hash(wc_operation.id()),
|
||||
short_operation_hash(repo_operation.id()),
|
||||
)?;
|
||||
locked_wc
|
||||
.check_out(&checkout_commit.tree())
|
||||
|
@ -638,16 +638,16 @@ impl WorkspaceCommandHelper {
|
|||
return Err(CommandError::InternalError(format!(
|
||||
"The repo was loaded at operation {}, which seems to be a sibling of the \
|
||||
working copy's operation {}",
|
||||
repo_operation.id().hex(),
|
||||
wc_operation.id().hex()
|
||||
short_operation_hash(repo_operation.id()),
|
||||
short_operation_hash(wc_operation.id()),
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
return Err(CommandError::InternalError(format!(
|
||||
"The repo was loaded at operation {}, which seems unrelated to the working \
|
||||
copy's operation {}",
|
||||
repo_operation.id().hex(),
|
||||
wc_operation.id().hex()
|
||||
short_operation_hash(repo_operation.id()),
|
||||
short_operation_hash(wc_operation.id()),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
@ -2117,6 +2117,10 @@ fn short_commit_hash(commit_id: &CommitId) -> String {
|
|||
commit_id.hex()[0..12].to_string()
|
||||
}
|
||||
|
||||
fn short_operation_hash(operation_id: &OperationId) -> String {
|
||||
operation_id.hex()[0..12].to_string()
|
||||
}
|
||||
|
||||
fn add_to_git_exclude(ui: &mut Ui, git_repo: &git2::Repository) -> Result<(), CommandError> {
|
||||
let exclude_file_path = git_repo.path().join("info").join("exclude");
|
||||
if exclude_file_path.exists() {
|
||||
|
|
Loading…
Reference in a new issue