forked from jj-vcs/jj
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit: rename
Commit::{author,committer}{→ _raw}
Prepare for `.mailmap` support.
- Loading branch information
1 parent
82ea1ba
commit c1d9de1
Showing
7 changed files
with
64 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,8 @@ fn test_initial(backend: TestRepoBackend) { | |
assert_eq!(parents, vec![store.root_commit()]); | ||
assert!(commit.predecessors().next().is_none()); | ||
assert_eq!(commit.description(), "description"); | ||
assert_eq!(commit.author(), &author_signature); | ||
assert_eq!(commit.committer(), &committer_signature); | ||
assert_eq!(commit.author_raw(), &author_signature); | ||
assert_eq!(commit.committer_raw(), &committer_signature); | ||
assert_eq!( | ||
store | ||
.root_commit() | ||
|
@@ -158,14 +158,14 @@ fn test_rewrite(backend: TestRepoBackend) { | |
assert_eq!(parents, vec![store.root_commit()]); | ||
let predecessors: Vec<_> = rewritten_commit.predecessors().try_collect().unwrap(); | ||
assert_eq!(predecessors, vec![initial_commit.clone()]); | ||
assert_eq!(rewritten_commit.author().name, settings.user_name()); | ||
assert_eq!(rewritten_commit.author().email, settings.user_email()); | ||
assert_eq!(rewritten_commit.author_raw().name, settings.user_name()); | ||
assert_eq!(rewritten_commit.author_raw().email, settings.user_email()); | ||
assert_eq!( | ||
rewritten_commit.committer().name, | ||
rewritten_commit.committer_raw().name, | ||
rewrite_settings.user_name() | ||
); | ||
assert_eq!( | ||
rewritten_commit.committer().email, | ||
rewritten_commit.committer_raw().email, | ||
rewrite_settings.user_email() | ||
); | ||
assert_eq!( | ||
|
@@ -214,10 +214,10 @@ fn test_rewrite_update_missing_user(backend: TestRepoBackend) { | |
) | ||
.write() | ||
.unwrap(); | ||
assert_eq!(initial_commit.author().name, ""); | ||
assert_eq!(initial_commit.author().email, ""); | ||
assert_eq!(initial_commit.committer().name, ""); | ||
assert_eq!(initial_commit.committer().email, ""); | ||
assert_eq!(initial_commit.author_raw().name, ""); | ||
assert_eq!(initial_commit.author_raw().email, ""); | ||
assert_eq!(initial_commit.committer_raw().name, ""); | ||
assert_eq!(initial_commit.committer_raw().email, ""); | ||
|
||
let config = config::Config::builder() | ||
.set_override("user.name", "Configured User") | ||
|
@@ -233,14 +233,14 @@ fn test_rewrite_update_missing_user(backend: TestRepoBackend) { | |
.write() | ||
.unwrap(); | ||
|
||
assert_eq!(rewritten_commit.author().name, "Configured User"); | ||
assert_eq!(rewritten_commit.author_raw().name, "Configured User"); | ||
assert_eq!( | ||
rewritten_commit.author().email, | ||
rewritten_commit.author_raw().email, | ||
"[email protected]" | ||
); | ||
assert_eq!(rewritten_commit.committer().name, "Configured User"); | ||
assert_eq!(rewritten_commit.committer_raw().name, "Configured User"); | ||
assert_eq!( | ||
rewritten_commit.committer().email, | ||
rewritten_commit.committer_raw().email, | ||
"[email protected]" | ||
); | ||
} | ||
|
@@ -272,8 +272,8 @@ fn test_rewrite_resets_author_timestamp(backend: TestRepoBackend) { | |
|
||
let initial_timestamp = | ||
Timestamp::from_datetime(chrono::DateTime::parse_from_rfc3339(initial_timestamp).unwrap()); | ||
assert_eq!(initial_commit.author().timestamp, initial_timestamp); | ||
assert_eq!(initial_commit.committer().timestamp, initial_timestamp); | ||
assert_eq!(initial_commit.author_raw().timestamp, initial_timestamp); | ||
assert_eq!(initial_commit.committer_raw().timestamp, initial_timestamp); | ||
|
||
// Rewrite discardable commit to no longer be discardable | ||
let new_timestamp_1 = "2002-03-04T05:06:07+08:00"; | ||
|
@@ -294,9 +294,15 @@ fn test_rewrite_resets_author_timestamp(backend: TestRepoBackend) { | |
Timestamp::from_datetime(chrono::DateTime::parse_from_rfc3339(new_timestamp_1).unwrap()); | ||
assert_ne!(new_timestamp_1, initial_timestamp); | ||
|
||
assert_eq!(rewritten_commit_1.author().timestamp, new_timestamp_1); | ||
assert_eq!(rewritten_commit_1.committer().timestamp, new_timestamp_1); | ||
assert_eq!(rewritten_commit_1.author(), rewritten_commit_1.committer()); | ||
assert_eq!(rewritten_commit_1.author_raw().timestamp, new_timestamp_1); | ||
assert_eq!( | ||
rewritten_commit_1.committer_raw().timestamp, | ||
new_timestamp_1 | ||
); | ||
assert_eq!( | ||
rewritten_commit_1.author_raw(), | ||
rewritten_commit_1.committer_raw() | ||
); | ||
|
||
// Rewrite non-discardable commit | ||
let new_timestamp_2 = "2003-04-05T06:07:08+09:00"; | ||
|
@@ -317,8 +323,11 @@ fn test_rewrite_resets_author_timestamp(backend: TestRepoBackend) { | |
Timestamp::from_datetime(chrono::DateTime::parse_from_rfc3339(new_timestamp_2).unwrap()); | ||
assert_ne!(new_timestamp_2, new_timestamp_1); | ||
|
||
assert_eq!(rewritten_commit_2.author().timestamp, new_timestamp_1); | ||
assert_eq!(rewritten_commit_2.committer().timestamp, new_timestamp_2); | ||
assert_eq!(rewritten_commit_2.author_raw().timestamp, new_timestamp_1); | ||
assert_eq!( | ||
rewritten_commit_2.committer_raw().timestamp, | ||
new_timestamp_2 | ||
); | ||
} | ||
|
||
#[test_case(TestRepoBackend::Local ; "local backend")] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters