Labels: list, tag current, sync-to
- Tools -> Labels: list server labels, create/tag a label at current head, one-click Sync workspace to a label (via Get Revision) - Backend p4 labels, p4 tag -l Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -485,6 +485,30 @@ 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 })
|
||||
}
|
||||
|
||||
/// List labels on the server (most-recently-updated first).
|
||||
#[tauri::command]
|
||||
async fn p4_labels(state: State<'_, AppState>) -> Result<Vec<Value>, String> {
|
||||
let conn = current(&state)?;
|
||||
run_json(&conn, &["labels", "-m", "300"])
|
||||
}
|
||||
|
||||
/// Tag revisions with a label (auto-creates the label if new). `rev` optional:
|
||||
/// a changelist, another label, or a date; empty = head. Scope confines it.
|
||||
#[tauri::command]
|
||||
async fn p4_label_tag(state: State<'_, AppState>, label: String, scope: String, rev: String) -> Result<String, String> {
|
||||
let conn = current(&state)?;
|
||||
let label = label.trim();
|
||||
if label.is_empty() {
|
||||
return Err("No label name".into());
|
||||
}
|
||||
let mut spec = scope_spec(&scope);
|
||||
let rev = rev.trim().trim_start_matches(['@', '#']);
|
||||
if !rev.is_empty() {
|
||||
spec = format!("{spec}@{rev}");
|
||||
}
|
||||
run_text(&conn, &["tag", "-l", label, &spec])
|
||||
}
|
||||
|
||||
/// 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]
|
||||
@ -2058,6 +2082,8 @@ pub fn run() {
|
||||
p4_typemap_set,
|
||||
p4_reopen_type,
|
||||
p4_sync_to,
|
||||
p4_labels,
|
||||
p4_label_tag,
|
||||
p4_client_spec,
|
||||
p4_client_save,
|
||||
uasset_thumbnail,
|
||||
|
||||
Reference in New Issue
Block a user