Move the old new_change_id function next to the tests

In the following commit, we replace it everywhere else.
This commit is contained in:
Ilya Grigoriev 2022-12-29 19:59:01 -08:00
parent bd234c13c5
commit 44d443a63b
3 changed files with 12 additions and 2 deletions

View file

@ -26,6 +26,7 @@ pub struct CommitBuilder<'repo> {
rewrite_source: Option<Commit>,
}
// TODO: This function will be replaced in the next commit.
pub fn new_change_id() -> ChangeId {
ChangeId::from_bytes(Uuid::new_v4().as_bytes())
}

View file

@ -1620,7 +1620,11 @@ mod tests {
use test_case::test_case;
use super::*;
use crate::commit_builder::new_change_id;
/// Note that this function produces different ids on subsequent test runs
/// TODO: The dependence on the uuid crate is unnecessary.
pub fn new_change_id() -> ChangeId {
ChangeId::from_bytes(uuid::Uuid::new_v4().as_bytes())
}
#[test_case(false; "memory")]
#[test_case(true; "file")]

View file

@ -2146,9 +2146,14 @@ fn has_diff_from_parent(repo: RepoRef<'_>, entry: &IndexEntry<'_>, matcher: &dyn
#[cfg(test)]
mod tests {
use super::*;
use crate::commit_builder::new_change_id;
use crate::index::MutableIndex;
/// Note that this function produces different ids on subsequent test runs
/// TODO: The dependence on the uuid crate is unnecessary.
pub fn new_change_id() -> crate::backend::ChangeId {
crate::backend::ChangeId::from_bytes(uuid::Uuid::new_v4().as_bytes())
}
fn parse(revset_str: &str) -> Result<Rc<RevsetExpression>, RevsetParseErrorKind> {
parse_with_aliases(revset_str, [] as [(&str, &str); 0])
}