| 1 |
// Copyright 2020 The Jujutsu Authors |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
use tracing::instrument; |
| 16 |
|
| 17 |
use crate::cli_util::CommandHelper; |
| 18 |
use crate::cli_util::print_snapshot_stats; |
| 19 |
use crate::command_error::CommandError; |
| 20 |
use crate::ui::Ui; |
| 21 |
|
| 22 |
/// Update a workspace that has become stale |
| 23 |
/// |
| 24 |
/// See the [stale working copy documentation] for more information. |
| 25 |
/// |
| 26 |
/// [stale working copy documentation]: |
| 27 |
/// https://docs.jj-vcs.dev/latest/working-copy/#stale-working-copy |
| 28 |
#[derive(clap::Args, Clone, Debug)] |
| 29 |
pub struct WorkspaceUpdateStaleArgs {} |
| 30 |
|
| 31 |
#[instrument(skip_all)] |
| 32 |
pub async fn cmd_workspace_update_stale( |
| 33 |
ui: &mut Ui, |
| 34 |
command: &CommandHelper, |
| 35 |
_args: &WorkspaceUpdateStaleArgs, |
| 36 |
) -> Result<(), CommandError> { |
| 37 |
let (workspace_command, stats) = command.recover_stale_working_copy(ui).await?; |
| 38 |
print_snapshot_stats(ui, &stats, workspace_command.env().path_converter())?; |
| 39 |
|
| 40 |
Ok(()) |
| 41 |
} |