Get Revision: sync workspace to a changelist / label / date

- Actions -> Get Revision... (enter CL number, label, or YYYY/MM/DD)
- History right-click -> Sync workspace to #N
- Backend p4 sync scope@rev with live transfer progress

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-07-08 11:43:56 +03:00
parent e2ad438ed4
commit 0fc0af38da
4 changed files with 39 additions and 1 deletions

View File

@ -485,6 +485,22 @@ async fn p4_sync(state: State<'_, AppState>, scope: String) -> Result<String, St
Ok(if msg.is_empty() { "Already up to date — nothing to sync.".into() } else { msg })
}
/// Sync the workspace to an exact revision: a changelist number, a label name,
/// or a date (`YYYY/MM/DD`). `rev` is appended to the scope spec as `@rev`.
#[tauri::command]
async fn p4_sync_to(state: State<'_, AppState>, scope: String, rev: String) -> Result<String, String> {
let conn = current(&state)?;
let rev = rev.trim();
if rev.is_empty() {
return Err("No revision specified".into());
}
// strip a leading @ or # if the user typed one
let rev = rev.trim_start_matches(['@', '#']);
let spec = format!("{}@{}", scope_spec(&scope), rev);
let msg = run_stream(&conn, &["sync", &spec], "sync")?;
Ok(if msg.is_empty() { "Already at that revision — nothing to sync.".into() } else { msg })
}
/// Unified diff of an opened file vs. the have revision.
#[tauri::command]
async fn p4_diff(state: State<'_, AppState>, file: String) -> Result<String, String> {
@ -2008,6 +2024,7 @@ pub fn run() {
p4_typemap_get,
p4_typemap_set,
p4_reopen_type,
p4_sync_to,
uasset_thumbnail,
uasset_export_3d,
p4_shelve,