mirror of
https://github.com/martinvonz/jj.git
synced 2024-10-24 07:32:54 +00:00
working_copy: pass only a TreeId
to LockedWorkingCopy::check_out()
It only needs a `TreeId`.
This commit is contained in:
parent
fabaf8b608
commit
45a00e819d
1 changed files with 3 additions and 4 deletions
|
@ -839,7 +839,7 @@ impl WorkingCopy {
|
||||||
) -> Result<CheckoutStats, CheckoutError> {
|
) -> Result<CheckoutStats, CheckoutError> {
|
||||||
let mut locked_wc = self.start_mutation();
|
let mut locked_wc = self.start_mutation();
|
||||||
let new_commit_id = new_commit.id().clone();
|
let new_commit_id = new_commit.id().clone();
|
||||||
let stats = match locked_wc.check_out(old_commit_id, new_commit) {
|
let stats = match locked_wc.check_out(old_commit_id, new_commit.tree_id().clone()) {
|
||||||
Err(CheckoutError::ConcurrentCheckout) => {
|
Err(CheckoutError::ConcurrentCheckout) => {
|
||||||
locked_wc.discard();
|
locked_wc.discard();
|
||||||
return Err(CheckoutError::ConcurrentCheckout);
|
return Err(CheckoutError::ConcurrentCheckout);
|
||||||
|
@ -874,9 +874,8 @@ impl LockedWorkingCopy<'_> {
|
||||||
pub fn check_out(
|
pub fn check_out(
|
||||||
&mut self,
|
&mut self,
|
||||||
old_commit_id: Option<&CommitId>,
|
old_commit_id: Option<&CommitId>,
|
||||||
new_commit: Commit,
|
new_tree_id: TreeId,
|
||||||
) -> Result<CheckoutStats, CheckoutError> {
|
) -> Result<CheckoutStats, CheckoutError> {
|
||||||
assert!(new_commit.is_open());
|
|
||||||
// TODO: Write a "pending_checkout" file with the old and new TreeIds so we can
|
// TODO: Write a "pending_checkout" file with the old and new TreeIds so we can
|
||||||
// continue an interrupted checkout if we find such a file.
|
// continue an interrupted checkout if we find such a file.
|
||||||
|
|
||||||
|
@ -894,7 +893,7 @@ impl LockedWorkingCopy<'_> {
|
||||||
.tree_state()
|
.tree_state()
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.check_out(new_commit.tree().id().clone())?;
|
.check_out(new_tree_id)?;
|
||||||
Ok(stats)
|
Ok(stats)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue