feat(svn): add Subversion merge dialog, eligible revisions picker, and reverse merge (#7344)

Subversion merge workflows on the built-in SVN backend. VCS > Subversion > Merge From... picks a source branch or URL, then merges selected eligible revisions (svn mergeinfo --show-revs eligible, paged), all revisions, or reintegrates a branch, with a test (dry-run) merge, depth, whitespace modes, --ignore-ancestry and --force. Reverse Merge (svn merge -c -REV) is in the VCS Log commit menu for Subversion revisions.

For a checkout of a subtree (trunk/module), the source URL keeps the working copy's path inside the branch. Revision ranges stay in SVN's native form (-r 100:120). Unsaved documents are saved and local changes are offered for review before merging. Streamed merge output runs under the working copy's write lock, so a merge cannot race Rollback.

Co-authored-by: RuyimgByCN <[email protected]>
Цей коміт міститься в:
RuyimgByCN authored and GitHub committed 2026-12-03 00:22:39 +08:00
1 джерело 304674d0fe
коміт 5c31ccfe70
21 files changed
+1746 -7

No files matched your search

+1
Переглянути файл
@@ -762,6 +762,7 @@ pub fn spec(os: Os) -> Vec<Entry> {
"subversion",
"Subversion",
vec![
act("svn.merge", "Merge From…"),
act("svn.cleanup", "Cleanup"),
act("svn.lock", "Lock…"),
act("svn.unlock", "Unlock"),
+216 -1
Переглянути файл
@@ -32,7 +32,95 @@ fn with_working_copy<T>(
};
match backend.as_deref().and_then(as_svn) {
Some(wc) => f(wc),
None => Err(IdeError::invalid("not in a Subversion working copy")),
None => Err(ide_core::IdeError::invalid("not in a Subversion working copy")),
}
}
/// Subversion branch/line URL resolved for a working copy (preserving any subtree subpath).
#[derive(Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct SvnMergeSource {
pub name: String,
pub url: String,
pub current: bool,
}
/// An eligible source revision returned to the Merge From… dialog.
#[derive(Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct SvnEligibleRevision {
pub revision: u64,
pub author: String,
pub time_ms: f64,
pub message: String,
}
/// Paginated response from `svn_eligible_revisions`.
#[derive(Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct SvnEligibleRevisionsPage {
pub items: Vec<SvnEligibleRevision>,
pub has_more: bool,
pub total: u32,
}
/// Checkout / merge depth for Subversion commands.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub enum SvnDepth {
Empty,
Files,
Immediates,
Infinity,
}
impl From<SvnDepth> for ide_svn::Depth {
fn from(depth: SvnDepth) -> Self {
match depth {
SvnDepth::Empty => Self::Empty,
SvnDepth::Files => Self::Files,
SvnDepth::Immediates => Self::Immediates,
SvnDepth::Infinity => Self::Infinity,
}
}
}
/// Options sent from the Subversion Merge From… dialog.
#[derive(Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct SvnMergeOptions {
pub source_url: String,
pub revisions: Option<String>,
#[serde(default)]
pub reintegrate: bool,
#[serde(default)]
pub dry_run: bool,
#[serde(default)]
pub record_only: bool,
#[serde(default)]
pub ignore_ancestry: bool,
#[serde(default)]
pub force: bool,
#[serde(default)]
pub ignore_whitespace: Option<String>,
#[serde(default)]
pub depth: Option<SvnDepth>,
}
/// Result counts and output lines from `svn_merge` / `svn_revert_revision`.
#[derive(Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct SvnMergeResult {
pub updated: u32,
pub added: u32,
pub deleted: u32,
pub conflicted: u32,
pub output: Vec<String>,
}
impl From<ide_svn::MergeResult> for SvnMergeResult {
fn from(r: ide_svn::MergeResult) -> Self {
Self { updated: r.updated, added: r.added, deleted: r.deleted, conflicted: r.conflicted, output: r.output }
}
}
@@ -258,15 +346,142 @@ pub async fn svn_checkout(
result
}
/// VCS › Subversion › Merge From…: candidate branch URLs preserving any subtree subpath.
#[command(trust = trusted)]
pub async fn svn_merge_sources(host: &Host, window: &str, repo: Option<PathBuf>) -> IdeResult<Vec<SvnMergeSource>> {
let project = host.project(window)?;
blocking(move || {
with_working_copy(&project, repo.as_deref(), |wc| {
let mut out = Vec::new();
for branch in wc.branches()? {
if branch.remote {
continue;
}
if let Ok(url) = wc.line_url(&branch.name) {
out.push(SvnMergeSource { name: branch.name, url, current: branch.current });
}
}
Ok(out)
})
})
.await
}
/// VCS › Subversion › Merge From… (Select Revisions): unmerged revisions on `source_url`.
#[command(trust = trusted)]
pub async fn svn_eligible_revisions(
host: &Host,
window: &str,
repo: Option<PathBuf>,
source_url: String,
limit: Option<u32>,
before_revision: Option<u64>,
request: ide_core::RequestId,
) -> IdeResult<SvnEligibleRevisionsPage> {
let project = host.project(window)?;
let cancel = host.begin_request(request);
let page_limit = usize::try_from(limit.unwrap_or(200)).unwrap_or(200);
let result = blocking(move || {
with_working_copy(&project, repo.as_deref(), |wc| {
let page = wc.eligible_revisions(&source_url, page_limit, before_revision, &cancel)?;
Ok(SvnEligibleRevisionsPage {
items: page
.items
.into_iter()
.map(|r| SvnEligibleRevision {
revision: r.revision,
author: r.author,
time_ms: r.time_ms,
message: r.message,
})
.collect(),
has_more: page.has_more,
total: page.total,
})
})
})
.await;
host.end_request(request);
result
}
/// VCS › Subversion › Merge From…: runs `svn merge` with streaming output.
#[command(trust = trusted)]
pub async fn svn_merge(
host: &Host,
window: &str,
repo: Option<PathBuf>,
request: ide_core::RequestId,
options: SvnMergeOptions,
on_output: crate::ops::Channel<String>,
) -> IdeResult<SvnMergeResult> {
let project = host.project(window)?;
let cancel = host.begin_request(request);
let dry_run = options.dry_run;
let result = blocking(move || {
let report = |line: String| {
let _ = on_output.send(line);
};
let opts = ide_svn::MergeOptions {
source_url: options.source_url,
revisions: options.revisions,
reintegrate: options.reintegrate,
dry_run: options.dry_run,
record_only: options.record_only,
ignore_ancestry: options.ignore_ancestry,
force: options.force,
ignore_whitespace: options.ignore_whitespace,
depth: options.depth.map(Into::into),
};
let res = with_working_copy(&project, repo.as_deref(), |wc| wc.merge_with_options(&opts, &cancel, &report))?;
if !dry_run {
project.vcs_changed();
}
Ok(res.into())
})
.await;
host.end_request(request);
result
}
/// Subversion Log › Reverse Merge Revision (`svn merge -c -REV`).
#[command(trust = trusted)]
pub async fn svn_revert_revision(
host: &Host,
window: &str,
repo: Option<PathBuf>,
request: ide_core::RequestId,
revision: u64,
on_output: crate::ops::Channel<String>,
) -> IdeResult<SvnMergeResult> {
let project = host.project(window)?;
let cancel = host.begin_request(request);
let result = blocking(move || {
let report = |line: String| {
let _ = on_output.send(line);
};
let res = with_working_copy(&project, repo.as_deref(), |wc| wc.revert_revision(revision, &cancel, &report))?;
project.vcs_changed();
Ok(res.into())
})
.await;
host.end_request(request);
result
}
ide_command::domain!(
svn:
svn_accept_incoming_delete,
svn_checkout,
svn_cleanup,
svn_eligible_revisions,
svn_lock,
svn_merge,
svn_merge_sources,
svn_properties,
svn_relocate,
svn_repository_info,
svn_revert_revision,
svn_set_property,
svn_unlock,
svn_version,
+62
Переглянути файл
@@ -246,6 +246,68 @@ async fn an_image_at_a_revision() {
assert_eq!(image, format!("data:image/png;base64,{}", ide_vfs::base64(b"\x89PNG first")));
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn svn_merge_eligible_revisions_and_revert_revision() {
let Some(fx) = fixture() else { return };
let trunk_url = format!("{}/trunk", fx.url);
let branch_url = format!("{}/branches/feat", fx.url);
fx.svn(&fx.base, &["copy", "-q", "-m", "branch feat", &trunk_url, &branch_url]);
let branch_wc = fx.base.join("branch-wc");
fx.svn(&fx.base, &["checkout", "-q", &branch_url, branch_wc.to_str().unwrap()]);
std::fs::write(branch_wc.join("feat.txt"), "feature line\n").unwrap();
fx.svn(&branch_wc, &["add", "-q", "feat.txt"]);
fx.svn(&branch_wc, &["commit", "-q", "-m", "feat commit"]);
let root = fx.checkout("wc");
let (host, _project) = open(&fx.base, &root).await;
let sources = svn::svn_merge_sources(&host, "main", None).await.unwrap();
assert!(sources.iter().any(|s| s.name == "branches/feat" && s.url == branch_url));
let eligible =
svn::svn_eligible_revisions(&host, "main", None, branch_url.clone(), None, None, ide_core::RequestId::next())
.await
.unwrap();
assert_eq!(eligible.items.len(), 1);
assert!(!eligible.has_more);
assert_eq!(eligible.total, 1);
assert_eq!(eligible.items[0].message, "feat commit");
let rev = eligible.items[0].revision;
let channel = ide_host::ops::Channel::new(|_: String| {});
let merged = svn::svn_merge(
&host,
"main",
None,
ide_core::RequestId::next(),
svn::SvnMergeOptions {
source_url: branch_url,
revisions: Some(rev.to_string()),
reintegrate: false,
dry_run: false,
record_only: false,
ignore_ancestry: false,
force: false,
ignore_whitespace: Some("all".into()),
depth: None,
},
channel,
)
.await
.unwrap();
assert_eq!(merged.added, 1);
assert!(root.join("feat.txt").exists());
fx.svn(&root, &["commit", "-q", "-m", "merge feat"]);
fx.svn(&root, &["update", "-q"]);
let channel2 = ide_host::ops::Channel::new(|_: String| {});
let reverted =
svn::svn_revert_revision(&host, "main", None, ide_core::RequestId::next(), rev + 1, channel2).await.unwrap();
assert_eq!(reverted.deleted, 1);
assert!(!root.join("feat.txt").exists());
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn svn_changelists_through_the_backend_changelist_commands() {
let Some(fx) = fixture() else { return };
+1 -1
Переглянути файл
@@ -16,7 +16,7 @@ pub use cli::{
MIN_VERSION, Prompt, PromptHandler, Settings, SvnContext, detect as detected_executable, is_login_required,
with_credentials,
};
pub use ops::{Depth, ResolveAccept};
pub use ops::{Depth, EligibleRevision, EligibleRevisionsPage, MergeOptions, MergeResult, ResolveAccept};
pub use workspace::{Layout, Repository, WorkingCopy};
pub use xml::{Lock, StatusEntry};
+289 -1
Переглянути файл
@@ -44,6 +44,129 @@ impl ResolveAccept {
}
}
/// Eligible source revision returned by `svn mergeinfo --show-revs eligible`.
#[derive(Clone, Debug, PartialEq)]
pub struct EligibleRevision {
pub revision: u64,
pub author: String,
pub time_ms: f64,
pub message: String,
}
/// Paginated response from [`WorkingCopy::eligible_revisions`].
#[derive(Clone, Debug, PartialEq)]
pub struct EligibleRevisionsPage {
pub items: Vec<EligibleRevision>,
pub has_more: bool,
pub total: u32,
}
/// Options for Subversion Merge (`svn merge`).
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct MergeOptions {
pub source_url: String,
pub revisions: Option<String>,
pub reintegrate: bool,
pub dry_run: bool,
pub record_only: bool,
pub ignore_ancestry: bool,
pub force: bool,
/// `None` (default), `"change"` (`-x -b`), `"all"` (`-x -w`), or `"eol"` (`-x --ignore-eol-style`).
pub ignore_whitespace: Option<String>,
/// Explicit merge depth (`--depth`), or `None` for SVN's default working copy depth.
pub depth: Option<Depth>,
}
/// Summary counts and streamed output from `svn merge`.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct MergeResult {
pub updated: u32,
pub added: u32,
pub deleted: u32,
pub conflicted: u32,
pub output: Vec<String>,
}
/// Valid Subversion source URL (`scheme://...` or repository-relative `^/...`).
fn validate_merge_source(url: &str) -> IdeResult<&str> {
let trimmed = url.trim();
if trimmed.is_empty() || !(trimmed.contains("://") || trimmed.starts_with("^/")) {
return Err(IdeError::invalid("Select or enter a valid Subversion URL"));
}
Ok(trimmed)
}
/// Parses comma-separated revisions or ranges (`100:120`, `100-120`, `105,108`) into `-r`/`-c` args.
fn merge_revision_args(raw: &str) -> IdeResult<Vec<String>> {
let mut out = Vec::new();
for part in raw.split(',').map(str::trim).filter(|s| !s.is_empty()) {
let normalized = part.strip_prefix("-c").unwrap_or(part).trim();
let range_norm = normalized.replace('-', ":");
if let Some((a, b)) = range_norm.split_once(':') {
let a_num: u64 = a
.trim()
.trim_start_matches(['r', 'R'])
.parse()
.map_err(|_| IdeError::invalid(format!("invalid revision: {part}")))?;
let b_num: u64 = b
.trim()
.trim_start_matches(['r', 'R'])
.parse()
.map_err(|_| IdeError::invalid(format!("invalid revision: {part}")))?;
out.push("-r".to_owned());
out.push(format!("{a_num}:{b_num}"));
} else {
let n: u64 = normalized
.trim_start_matches(['r', 'R'])
.parse()
.map_err(|_| IdeError::invalid(format!("invalid revision: {part}")))?;
out.push("-c".to_owned());
out.push(n.to_string());
}
}
if out.is_empty() {
return Err(IdeError::invalid("Select at least one revision or enter a revision range"));
}
Ok(out)
}
/// Strict 5-column parser for `svn update` / `svn merge` output lines, ignoring headers/summaries.
fn parse_svn_action_line(line: &str) -> Option<(u8, u8, u8)> {
let bytes = line.as_bytes();
if bytes.len() <= 5 || bytes[4] != b' ' {
return None;
}
let valid_col0 = matches!(bytes[0], b' ' | b'U' | b'A' | b'D' | b'G' | b'C' | b'E' | b'R');
let valid_col1 = matches!(bytes[1], b' ' | b'U' | b'C' | b'G' | b'M');
let valid_col2 = matches!(bytes[2], b' ' | b'B');
let valid_col3 = matches!(bytes[3], b' ' | b'C');
let any_status = bytes[0] != b' ' || bytes[1] != b' ' || bytes[2] != b' ' || bytes[3] != b' ';
if valid_col0 && valid_col1 && valid_col2 && valid_col3 && any_status && !line[5..].trim().is_empty() {
Some((bytes[0], bytes[1], bytes[3]))
} else {
None
}
}
fn parse_merge_output(lines: Vec<String>) -> MergeResult {
let mut res = MergeResult { output: lines, ..MergeResult::default() };
for line in &res.output {
if let Some((col0, col1, col3)) = parse_svn_action_line(line) {
if col0 == b'C' || col1 == b'C' || col3 == b'C' {
res.conflicted += 1;
continue;
}
match if col0 != b' ' { col0 } else { col1 } {
b'U' | b'G' | b'R' => res.updated += 1,
b'A' => res.added += 1,
b'D' => res.deleted += 1,
_ => {}
}
}
}
res
}
/// How much of a folder a checkout brings.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum Depth {
@@ -273,6 +396,142 @@ impl WorkingCopy {
self.remote(&argv, Some(cancel)).map(|_| ())
}
/// Eligible unmerged revisions from `source_url` (`svn mergeinfo --show-revs eligible`),
/// newest first, paginated in chunks of up to 200 entries.
pub fn eligible_revisions(
&self,
source_url: &str,
limit: usize,
before_revision: Option<u64>,
cancel: &CancellationToken,
) -> IdeResult<EligibleRevisionsPage> {
let source_url = validate_merge_source(source_url)?;
let mut argv = args(["mergeinfo", "--show-revs", "eligible"]);
argv.push("--".into());
argv.push(url_target(source_url));
argv.push(self.root().into());
let out = self.remote(&argv, Some(cancel))?;
let mut revs: Vec<u64> = String::from_utf8_lossy(&out)
.lines()
.filter_map(|line| line.trim().trim_start_matches(['r', 'R']).parse::<u64>().ok())
.filter(|&r| r > 0)
.collect();
revs.sort_unstable_by(|a, b| b.cmp(a));
revs.dedup();
let total = u32::try_from(revs.len()).unwrap_or(u32::MAX);
let filtered: Vec<u64> = match before_revision {
Some(before) => revs.into_iter().filter(|&r| r < before).collect(),
None => revs,
};
if filtered.is_empty() {
return Ok(EligibleRevisionsPage { items: Vec::new(), has_more: false, total });
}
let take_n = limit.clamp(1, 200);
let has_more = filtered.len() > take_n;
let page_revs: Vec<u64> = filtered.into_iter().take(take_n).collect();
let wanted: std::collections::HashSet<u64> = page_revs.iter().copied().collect();
let min_rev = *page_revs.last().unwrap();
let max_rev = *page_revs.first().unwrap();
let range = format!("{max_rev}:{min_rev}");
let mut log_argv = args(["log", "--xml", "-r", &range, "--"]);
log_argv.push(url_target(source_url));
let log_out = self.remote(&log_argv, Some(cancel))?;
let mut by_rev: std::collections::HashMap<u64, xml::LogEntry> =
xml::log(&log_out)?.into_iter().filter(|e| wanted.contains(&e.revision)).map(|e| (e.revision, e)).collect();
let items = page_revs
.into_iter()
.map(|rev| match by_rev.remove(&rev) {
Some(entry) => EligibleRevision {
revision: rev,
author: entry.author,
time_ms: entry.time_ms,
message: entry.message,
},
None => EligibleRevision { revision: rev, author: String::new(), time_ms: 0.0, message: String::new() },
})
.collect();
Ok(EligibleRevisionsPage { items, has_more, total })
}
/// Merges `opts.source_url` into the working copy with full IDEA Merge dialog options.
pub fn merge_with_options(
&self,
opts: &MergeOptions,
cancel: &CancellationToken,
on_line: &dyn Fn(String),
) -> IdeResult<MergeResult> {
let source_url = validate_merge_source(&opts.source_url)?;
let mut argv = args(["merge", "--accept", "postpone"]);
if let Some(depth) = opts.depth {
argv.extend(args(["--depth", depth.arg()]));
}
if opts.dry_run {
argv.push("--dry-run".into());
}
if opts.reintegrate {
argv.push("--reintegrate".into());
}
if opts.record_only {
argv.push("--record-only".into());
}
if opts.ignore_ancestry {
argv.push("--ignore-ancestry".into());
}
if opts.force {
argv.push("--force".into());
}
if let Some(ws) = opts.ignore_whitespace.as_deref().map(str::trim).filter(|s| !s.is_empty()) {
match ws {
"all" => argv.extend(args(["-x", "-w"])),
"change" => argv.extend(args(["-x", "-b"])),
"eol" => argv.extend(args(["-x", "--ignore-eol-style"])),
other => return Err(IdeError::invalid(format!("unsupported whitespace mode: {other}"))),
}
}
if let Some(revs) = opts.revisions.as_deref().map(str::trim).filter(|r| !r.is_empty()) {
argv.extend(args(merge_revision_args(revs)?));
}
argv.push("--".into());
argv.push(url_target(source_url));
argv.push(self.root().into());
let collected = parking_lot::Mutex::new(Vec::new());
let tee = |line: String| {
on_line(line.clone());
collected.lock().push(line);
};
self.remote_streaming(&argv, Some(cancel), &tee)?;
if !opts.dry_run {
let _ = self.refresh();
}
Ok(parse_merge_output(collected.into_inner()))
}
/// Reverse-merges a single revision (`svn merge -c -REV`) from the working copy's own URL.
pub fn revert_revision(
&self,
revision: u64,
cancel: &CancellationToken,
on_line: &dyn Fn(String),
) -> IdeResult<MergeResult> {
if revision == 0 {
return Err(IdeError::invalid("revision must be positive"));
}
let repo_url = self.current_repository().url;
let change = format!("-{revision}");
let mut argv = args(["merge", "--accept", "postpone", "-c", &change]);
argv.push("--".into());
argv.push(url_target(&repo_url));
argv.push(self.root().into());
let collected = parking_lot::Mutex::new(Vec::new());
let tee = |line: String| {
on_line(line.clone());
collected.lock().push(line);
};
self.remote_streaming(&argv, Some(cancel), &tee)?;
let _ = self.refresh();
Ok(parse_merge_output(collected.into_inner()))
}
/// `svn relocate`: the same repository moved, `url` being this working copy's
/// new URL (another host or scheme, the same path in the repository).
pub fn relocate(&self, url: &str, cancel: &CancellationToken) -> IdeResult<()> {
@@ -374,7 +633,7 @@ impl WorkingCopy {
/// The URL of line `line` (`trunk`, `branches/x`) for this working copy:
/// the same subfolder when it is one.
fn line_url(&self, line: &str) -> IdeResult<String> {
pub fn line_url(&self, line: &str) -> IdeResult<String> {
let repository = self.current_repository();
let layout = Layout::of(&repository.path)
.ok_or_else(|| IdeError::invalid("the working copy is not in a trunk / branches / tags layout"))?;
@@ -725,4 +984,33 @@ mod tests {
let externals = "Updating '.':\nFetching external item into 'ext':\nUpdated external to revision 90.\n\nUpdated to revision 7.\n";
assert_eq!(reached_revision(externals), Some(7));
}
#[test]
fn parses_merge_action_lines_and_revision_specs() {
assert_eq!(parse_svn_action_line("--- Merging r2 into '.':"), None);
assert_eq!(parse_svn_action_line("Updated external to revision 90."), None);
assert_eq!(parse_svn_action_line("U src/main.rs"), Some((b'U', b' ', b' ')));
assert_eq!(parse_svn_action_line("A src/added.rs"), Some((b'A', b' ', b' ')));
assert_eq!(parse_svn_action_line("D src/gone.rs"), Some((b'D', b' ', b' ')));
assert_eq!(parse_svn_action_line("C src/conflict.rs"), Some((b'C', b' ', b' ')));
assert_eq!(parse_svn_action_line(" C src/tree.rs"), Some((b' ', b' ', b'C')));
let res = parse_merge_output(vec![
"--- Merging r4 through r5 into '.':".into(),
"U src/main.rs".into(),
"A src/added.rs".into(),
" D src/gone.rs".into(),
"G src/merged.rs".into(),
"C src/conflict.rs".into(),
"Summary of conflicts:".into(),
" Text conflicts: 1".into(),
]);
assert_eq!((res.updated, res.added, res.deleted, res.conflicted), (2, 1, 0, 1));
assert_eq!(merge_revision_args("100:120").unwrap(), vec!["-r", "100:120"]);
assert_eq!(merge_revision_args("120:100").unwrap(), vec!["-r", "120:100"]);
assert_eq!(merge_revision_args("r105, -c 108").unwrap(), vec!["-c", "105", "-c", "108"]);
assert!(merge_revision_args("abc").is_err());
assert!(merge_revision_args(" , ").is_err());
}
}
+10
Переглянути файл
@@ -301,6 +301,16 @@ impl WorkingCopy {
f()
}
/// Streams output lines from a remote command under the per-checkout write lock with lock cleanup on kill.
pub(crate) fn remote_streaming(
&self,
args: &[OsString],
cancel: Option<&CancellationToken>,
on_line: &dyn Fn(String),
) -> IdeResult<Vec<u8>> {
self.writing(args, || self.unlocked_after(args, self.svn.run_streaming(args, REMOTE, cancel, Some(on_line))))
}
/// A command that writes to the working copy, stopped mid-way (cancelled, timed out),
/// leaves its lock behind: svn notices no signal while it waits on the server, and is
/// killed. It held the lock, so Cleanup takes it back. Commands that only read take no
+168
Переглянути файл
@@ -0,0 +1,168 @@
//! Integration tests for Subversion merge options, eligible revisions, and reverse merge.
mod common;
use ide_core::CancellationToken;
use ide_svn::{Depth, MergeOptions, WorkingCopy};
use std::process::Command;
#[test]
fn lists_eligible_revisions_merges_with_options_and_reverts_revision() {
let Some(r) = common::repo() else { return };
let trunk_url = format!("{}/trunk", r.url);
let branch_url = format!("{}/branches/feat", r.url);
let cancel = CancellationToken::new();
// Seed trunk r2, then copy trunk -> branches/feat at r3.
let trunk_seed = r.base.join("seed");
r.svn(&r.base, &["checkout", "-q", &trunk_url, trunk_seed.to_str().unwrap()]);
std::fs::write(trunk_seed.join("app.txt"), "v1\n").unwrap();
r.svn(&trunk_seed, &["add", "app.txt"]);
r.svn(&trunk_seed, &["commit", "-q", "-m", "initial app"]);
r.svn(&r.base, &["copy", "-q", "-m", "branch feat", &trunk_url, &branch_url]);
// Commit two revisions on branch (r4, r5).
let branch_wc_dir = r.base.join("branch-wc");
r.svn(&r.base, &["checkout", "-q", &branch_url, branch_wc_dir.to_str().unwrap()]);
std::fs::write(branch_wc_dir.join("feat1.txt"), "one\n").unwrap();
r.svn(&branch_wc_dir, &["add", "feat1.txt"]);
r.svn(&branch_wc_dir, &["commit", "-q", "-m", "add feat1"]);
std::fs::write(branch_wc_dir.join("feat2.txt"), "two\n").unwrap();
r.svn(&branch_wc_dir, &["add", "feat2.txt"]);
r.svn(&branch_wc_dir, &["commit", "-q", "-m", "add feat2"]);
// Open trunk working copy as WorkingCopy.
let wc_dir = r.base.join("trunk-wc");
r.svn(&r.base, &["checkout", "-q", &trunk_url, wc_dir.to_str().unwrap()]);
let wc = WorkingCopy::discover(&wc_dir, common::ctx()).unwrap().expect("svn wc");
// Pagination of eligible revisions (limit = 1 then before_revision).
let page1 = wc.eligible_revisions(&branch_url, 1, None, &cancel).unwrap();
assert!(page1.has_more);
assert_eq!(page1.total, 2);
assert_eq!(page1.items.len(), 1);
assert_eq!(page1.items[0].message, "add feat2");
let page2 = wc.eligible_revisions(&branch_url, 1, Some(page1.items[0].revision), &cancel).unwrap();
assert!(!page2.has_more);
assert_eq!(page2.items.len(), 1);
assert_eq!(page2.items[0].message, "add feat1");
let r_first = page2.items[0].revision;
let r_second = page1.items[0].revision;
// Dry run merge does not modify working tree.
let dry = wc
.merge_with_options(
&MergeOptions {
source_url: branch_url.clone(),
revisions: Some(r_first.to_string()),
dry_run: true,
..MergeOptions::default()
},
&cancel,
&|_| {},
)
.unwrap();
assert_eq!(dry.added, 1);
assert!(!wc_dir.join("feat1.txt").exists());
// Actual cherry-pick merge of r_first leaves r_second still eligible.
let merged = wc
.merge_with_options(
&MergeOptions {
source_url: branch_url.clone(),
revisions: Some(r_first.to_string()),
ignore_whitespace: Some("all".into()),
..MergeOptions::default()
},
&cancel,
&|_| {},
)
.unwrap();
assert_eq!(merged.added, 1);
assert!(wc_dir.join("feat1.txt").exists());
assert!(!wc_dir.join("feat2.txt").exists());
// Commit r_first merge on trunk, then update & reverse-merge the commit.
r.svn(&wc_dir, &["commit", "-q", "-m", "merge feat1"]);
r.svn(&wc_dir, &["update", "-q"]);
let rev_after = Command::new("svnversion").arg(&wc_dir).output().unwrap();
let head_rev: u64 = String::from_utf8_lossy(&rev_after.stdout).trim().parse().unwrap();
let reversed = wc.revert_revision(head_rev, &cancel, &|_| {}).unwrap();
assert_eq!(reversed.deleted, 1);
assert!(!wc_dir.join("feat1.txt").exists());
let _ = r_second;
}
#[test]
fn preserves_subtree_line_url_native_colon_range_and_depth_option() {
let Some(r) = common::repo() else { return };
let trunk_url = format!("{}/trunk", r.url);
let branch_url = format!("{}/branches/feat", r.url);
let cancel = CancellationToken::new();
// Seed trunk/module/base.txt + sub/nested.txt, then copy trunk -> branches/feat.
let seed = r.base.join("seed");
r.svn(&r.base, &["checkout", "-q", &trunk_url, seed.to_str().unwrap()]);
std::fs::create_dir_all(seed.join("module/sub")).unwrap();
std::fs::write(seed.join("module/base.txt"), "base\n").unwrap();
std::fs::write(seed.join("module/sub/nested.txt"), "nested\n").unwrap();
r.svn(&seed, &["add", "module"]);
r.svn(&seed, &["commit", "-q", "-m", "seed module"]);
r.svn(&r.base, &["copy", "-q", "-m", "branch feat", &trunk_url, &branch_url]);
// Make three distinct commits on branches/feat/module: rA, rB, rC.
let branch_module_url = format!("{branch_url}/module");
let branch_wc = r.base.join("branch-module");
r.svn(&r.base, &["checkout", "-q", &branch_module_url, branch_wc.to_str().unwrap()]);
std::fs::write(branch_wc.join("ra.txt"), "ra\n").unwrap();
r.svn(&branch_wc, &["add", "ra.txt"]);
r.svn(&branch_wc, &["commit", "-q", "-m", "commit A"]);
std::fs::write(branch_wc.join("rb.txt"), "rb\n").unwrap();
r.svn(&branch_wc, &["add", "rb.txt"]);
r.svn(&branch_wc, &["commit", "-q", "-m", "commit B"]);
std::fs::write(branch_wc.join("rc.txt"), "rc\n").unwrap();
std::fs::write(branch_wc.join("sub/nested.txt"), "nested-updated\n").unwrap();
r.svn(&branch_wc, &["add", "rc.txt"]);
r.svn(&branch_wc, &["commit", "-q", "-m", "commit C"]);
// Checkout subtree trunk/module and resolve branch URL via WorkingCopy::line_url.
let sub_wc_dir = r.base.join("trunk-module");
r.svn(&r.base, &["checkout", "-q", &format!("{trunk_url}/module"), sub_wc_dir.to_str().unwrap()]);
let wc = WorkingCopy::discover(&sub_wc_dir, common::ctx()).unwrap().expect("subtree wc");
let resolved = wc.line_url("branches/feat").unwrap();
assert_eq!(resolved, branch_module_url);
let page = wc.eligible_revisions(&resolved, 10, None, &cancel).unwrap();
let revs: Vec<u64> = page.items.iter().map(|i| i.revision).collect();
assert_eq!(revs.len(), 3);
let r_c = revs[0];
let r_b = revs[1];
let r_a = revs[2];
assert!(r_a < r_b && r_b < r_c);
// Native colon range r_a:r_c with Depth::Files applies r_b and r_c top-level files, NOT r_a and NOT nested sub/ edit.
wc.merge_with_options(
&MergeOptions {
source_url: resolved,
revisions: Some(format!("{r_a}:{r_c}")),
depth: Some(Depth::Files),
..MergeOptions::default()
},
&cancel,
&|_| {},
)
.unwrap();
assert!(!sub_wc_dir.join("ra.txt").exists(), "start revision r_a in -r r_a:r_c must NOT be included");
assert!(sub_wc_dir.join("rb.txt").exists(), "r_b must be merged");
assert!(sub_wc_dir.join("rc.txt").exists(), "r_c top-level file must be merged");
assert_eq!(
std::fs::read_to_string(sub_wc_dir.join("sub/nested.txt")).unwrap(),
"nested\n",
"Depth::Files should leave nested directory untouched"
);
}
+4
Переглянути файл
@@ -783,10 +783,14 @@ structural_validate always project_host bin
svn_accept_incoming_delete trusted project_host bindings async
svn_checkout always project_host bindings async
svn_cleanup trusted project_host bindings async
svn_eligible_revisions trusted project_host bindings async
svn_lock trusted project_host bindings async
svn_merge trusted project_host bindings async
svn_merge_sources trusted project_host bindings async
svn_properties trusted project_host bindings async
svn_relocate trusted project_host bindings async
svn_repository_info trusted project_host bindings async
svn_revert_revision trusted project_host bindings async
svn_set_property trusted project_host bindings async
svn_unlock trusted project_host bindings async
svn_version always project_host bindings async
+55
Переглянути файл
@@ -2358,13 +2358,21 @@ export const commands = {
* releases the working copy's lock.
*/
svnCleanup: (repo: string | null) => typedError<null, IdeError>(__TAURI_INVOKE("svn_cleanup", { repo })),
/** VCS › Subversion › Merge From… (Select Revisions): unmerged revisions on `source_url`. */
svnEligibleRevisions: (repo: string | null, sourceUrl: string, limit: number | null, beforeRevision: number | null, request: RequestId) => typedError<SvnEligibleRevisionsPage, IdeError>(__TAURI_INVOKE("svn_eligible_revisions", { repo, sourceUrl, limit, beforeRevision, request })),
/** VCS › Subversion › Lock: `svn lock` with a comment; `steal` takes a lock someone else holds. */
svnLock: (paths: string[], comment: string, steal: boolean) => typedError<null, IdeError>(__TAURI_INVOKE("svn_lock", { paths, comment, steal })),
/** VCS › Subversion › Merge From…: runs `svn merge` with streaming output. */
svnMerge: (repo: string | null, request: RequestId, options: SvnMergeOptions, onOutput: Channel<string>) => typedError<SvnMergeResult, IdeError>(__TAURI_INVOKE("svn_merge", { repo, request, options, onOutput })),
/** VCS › Subversion › Merge From…: candidate branch URLs preserving any subtree subpath. */
svnMergeSources: (repo: string | null) => typedError<SvnMergeSource[], IdeError>(__TAURI_INVOKE("svn_merge_sources", { repo })),
/** VCS › Subversion › Properties: the properties of a file or folder. */
svnProperties: (path: string) => typedError<SvnProperty[], IdeError>(__TAURI_INVOKE("svn_properties", { path })),
/** VCS › Subversion › Relocate: the same repository at a new URL (another host or scheme). */
svnRelocate: (repo: string | null, url: string) => typedError<null, IdeError>(__TAURI_INVOKE("svn_relocate", { repo, url })),
svnRepositoryInfo: (repo: string | null) => typedError<SvnRepositoryInfo, IdeError>(__TAURI_INVOKE("svn_repository_info", { repo })),
/** Subversion Log › Reverse Merge Revision (`svn merge -c -REV`). */
svnRevertRevision: (repo: string | null, request: RequestId, revision: number, onOutput: Channel<string>) => typedError<SvnMergeResult, IdeError>(__TAURI_INVOKE("svn_revert_revision", { repo, request, revision, onOutput })),
/** Sets property `name` of `path`, or deletes it when `value` is `None`. */
svnSetProperty: (path: string, name: string, value: string | null) => typedError<null, IdeError>(__TAURI_INVOKE("svn_set_property", { path, name, value })),
/** VCS › Subversion › Unlock; `force` breaks a lock this working copy does not hold. */
@@ -17142,6 +17150,53 @@ export type StubLink = {
export type SubmoduleRollbackSource = "head" | "index";
/** Checkout / merge depth for Subversion commands. */
export type SvnDepth = "empty" | "files" | "immediates" | "infinity";
/** An eligible source revision returned to the Merge From… dialog. */
export type SvnEligibleRevision = {
revision: number,
author: string,
timeMs: number | null,
message: string,
};
/** Paginated response from `svn_eligible_revisions`. */
export type SvnEligibleRevisionsPage = {
items: SvnEligibleRevision[],
hasMore: boolean,
total: number,
};
/** Options sent from the Subversion Merge From… dialog. */
export type SvnMergeOptions = {
sourceUrl: string,
revisions: string | null,
reintegrate?: boolean,
dryRun?: boolean,
recordOnly?: boolean,
ignoreAncestry?: boolean,
force?: boolean,
ignoreWhitespace?: string | null,
depth?: SvnDepth | null,
};
/** Result counts and output lines from `svn_merge` / `svn_revert_revision`. */
export type SvnMergeResult = {
updated: number,
added: number,
deleted: number,
conflicted: number,
output: string[],
};
/** Subversion branch/line URL resolved for a working copy (preserving any subtree subpath). */
export type SvnMergeSource = {
name: string,
url: string,
current: boolean,
};
/** One versioned property (`svn:ignore`, `svn:needs-lock`, or the user's own). */
export type SvnProperty = {
name: string,
+14 -3
Переглянути файл
@@ -17,7 +17,7 @@ import { useWorkflowSettings } from "@/platform/workflowSettings";
import styles from "./LocalChangesReviewDialog.module.css";
export type AffectedFiles = readonly [repo: string | null, files: readonly string[]];
type ReviewMode = "checkout" | "merge" | "blockedMerge";
type ReviewMode = "checkout" | "merge" | "blockedMerge" | "svnMerge";
type ReviewDecision = { mode: CheckoutOptions["mode"]; files: AffectedFiles[] };
const operationText = {
@@ -41,6 +41,17 @@ const operationText = {
shelve: "Smart Merge shelves your changes and restores them after merging.",
stash: "Smart Merge stashes your changes and restores them after merging.",
},
svnMerge: {
title: "Subversion Local Changes",
wouldOverwrite:
"There are uncommitted local changes in this working copy. Review or roll them back before merging, or continue anyway.",
cleared: "The listed local changes are gone. You can retry merging.",
regular: "Merge",
smart: "Merge",
cancel: "Don't Merge",
shelve: "",
stash: "",
},
};
interface ReviewFile {
@@ -168,7 +179,7 @@ function LocalChangesReviewDialog({
useDiffSource(content, rollingBack ? null : { diff: () => reviewDiff(chosen), show: () => showDiff(chosen) });
const blocked = files.length > 0;
const text = operationText[operation === "checkout" ? "checkout" : "merge"];
const text = operationText[operation === "checkout" ? "checkout" : operation === "svnMerge" ? "svnMerge" : "merge"];
const reviewOnly = operation === "blockedMerge";
const buttons: DialogButton[] = reviewOnly
? [{ label: "Close", role: "cancel", disabled: rollingBack }]
@@ -210,7 +221,7 @@ function LocalChangesReviewDialog({
<p>
<T>{blocked ? text.wouldOverwrite : text.cleared}</T>
</p>
{blocked && !reviewOnly && (
{blocked && !reviewOnly && operation !== "svnMerge" && (
<p className={styles.hint}>
<T>{text[policy]}</T>
</p>
+185
Переглянути файл
@@ -0,0 +1,185 @@
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { SvnEligibleRevision, SvnMergeSource } from "@/bindings";
import { commands } from "@/platform/ipc";
import { reviewLocalChanges } from "../LocalChangesReviewDialog";
import * as vcsOps from "../ops";
import { useVcs } from "../store";
import { formatSvnMergeRevisionFlags, SvnMergeDialog, svnRevertRevision } from "../svnMerge";
vi.mock("@tauri-apps/api/core", async (orig) => ({
...(await orig<typeof import("@tauri-apps/api/core")>()),
Channel: class {
onmessage: ((line: string) => void) | null = null;
},
}));
vi.mock("../LocalChangesReviewDialog", () => ({
reviewLocalChanges: vi.fn(),
}));
vi.mock("../store", async (orig) => {
const actual = await orig<typeof import("../store")>();
return {
...actual,
refreshNow: vi.fn().mockResolvedValue(undefined),
};
});
vi.mock("@/platform/ipc", async (orig) => {
const actual = await orig<typeof import("@/platform/ipc")>();
return {
...actual,
commands: {
...actual.commands,
svnMergeSources: vi.fn(),
svnEligibleRevisions: vi.fn(),
svnMerge: vi.fn(),
svnRevertRevision: vi.fn(),
},
};
});
describe("Subversion Merge dialog & Reverse Merge", () => {
beforeEach(() => {
vi.clearAllMocks();
useVcs.setState({ roots: ["/wc"], repo: "/wc", status: [] });
vi.spyOn(vcsOps, "saveAll").mockResolvedValue();
const sources: SvnMergeSource[] = [
{ name: "trunk", url: "https://svn.example.com/repo/trunk/sub", current: false },
{ name: "branches/feat", url: "https://svn.example.com/repo/branches/feat/sub", current: true },
];
vi.mocked(commands.svnMergeSources).mockResolvedValue({ status: "ok", data: sources });
vi.mocked(reviewLocalChanges).mockResolvedValue({ mode: "normal", files: [] });
});
it("formats merge revision specs strictly", () => {
expect(formatSvnMergeRevisionFlags("100:120")).toBe("-r 100:120");
expect(formatSvnMergeRevisionFlags("105, 108")).toBe("-c 105,108");
expect(formatSvnMergeRevisionFlags("r42")).toBe("-c 42");
expect(formatSvnMergeRevisionFlags("abc")).toBeNull();
expect(formatSvnMergeRevisionFlags(" , ")).toBeNull();
});
it("loads eligible revisions with pagination, preserves subtree source URLs, validates range, and runs dry-run merge with depth", async () => {
const page1: SvnEligibleRevision[] = [
{ revision: 51, author: "bob", timeMs: 1_700_000_000_000, message: "Fix login flow" },
];
const page2: SvnEligibleRevision[] = [
{ revision: 40, author: "alice", timeMs: 1_699_900_000_000, message: "Older commit" },
];
vi.mocked(commands.svnEligibleRevisions)
.mockResolvedValueOnce({ status: "ok", data: { items: page1, hasMore: true, total: 2 } })
.mockResolvedValueOnce({ status: "ok", data: { items: page1, hasMore: true, total: 2 } })
.mockResolvedValueOnce({ status: "ok", data: { items: page2, hasMore: false, total: 2 } });
vi.mocked(commands.svnMerge).mockResolvedValueOnce({
status: "ok",
data: { updated: 1, added: 0, deleted: 0, conflicted: 0, output: ["U src/app.ts"] },
});
render(<SvnMergeDialog repo="/wc" onClose={vi.fn()} />);
await waitFor(() =>
expect(
(screen.getByPlaceholderText("https://svn.example.com/repos/project/branches/feature") as HTMLInputElement)
.value,
).toBe("https://svn.example.com/repo/trunk/sub"),
);
fireEvent.click(screen.getByText("Select Revisions"));
await waitFor(() => expect(screen.getByText("r51")).toBeTruthy());
expect(screen.getByText("Fix login flow")).toBeTruthy();
const cb = screen.getByText("r51").closest("label")!.querySelector("input[type='checkbox']") as HTMLInputElement;
fireEvent.click(cb);
expect(cb.checked).toBe(true);
const sourceInput = screen.getByPlaceholderText("https://svn.example.com/repos/project/branches/feature");
fireEvent.change(sourceInput, { target: { value: "https://svn.example.com/repo/branches/other/sub" } });
await waitFor(() => {
const resetCb = screen
.getByText("r51")
.closest("label")!
.querySelector("input[type='checkbox']") as HTMLInputElement;
expect(resetCb.checked).toBe(false);
});
fireEvent.click(screen.getByText("Load older revisions…"));
await waitFor(() => expect(screen.getByText("r40")).toBeTruthy());
expect(commands.svnEligibleRevisions).toHaveBeenLastCalledWith(
"/wc",
"https://svn.example.com/repo/branches/other/sub",
200,
51,
expect.any(Number),
);
const revInput = screen.getByPlaceholderText("100:120 or 105,108");
fireEvent.change(revInput, { target: { value: "abc" } });
fireEvent.click(screen.getByText("Merge"));
expect(await screen.findByText("Enter revisions like 100:120 or 105,108")).toBeTruthy();
expect(commands.svnMerge).not.toHaveBeenCalled();
fireEvent.change(revInput, { target: { value: "51" } });
fireEvent.click(screen.getByLabelText("Depth"));
fireEvent.click(screen.getByRole("option", { name: "Files (direct file children)" }));
fireEvent.click(screen.getByLabelText("Dry run (test merge without modifying files)"));
fireEvent.click(screen.getByText("Merge"));
await waitFor(() =>
expect(commands.svnMerge).toHaveBeenCalledWith(
"/wc",
expect.any(Number),
expect.objectContaining({
sourceUrl: "https://svn.example.com/repo/branches/other/sub",
revisions: "51",
dryRun: true,
depth: "files",
}),
expect.anything(),
),
);
expect(await screen.findByText(/U\s+src\/app\.ts/)).toBeTruthy();
});
it("saves buffers and prompts on local changes before a real merge", async () => {
useVcs.setState({
roots: ["/wc"],
repo: "/wc",
status: [
{
path: "/wc/a.txt",
relPath: "a.txt",
staged: null,
unstaged: "modified",
conflicted: false,
renamedFrom: null,
changelist: null,
} as never,
],
});
vi.mocked(reviewLocalChanges).mockResolvedValueOnce(null);
render(<SvnMergeDialog repo="/wc" onClose={vi.fn()} />);
await waitFor(() =>
expect(
(screen.getByPlaceholderText("https://svn.example.com/repos/project/branches/feature") as HTMLInputElement)
.value,
).toBe("https://svn.example.com/repo/trunk/sub"),
);
fireEvent.click(screen.getByText("Merge"));
await waitFor(() => expect(reviewLocalChanges).toHaveBeenCalledWith("svnMerge", [["/wc", ["a.txt"]]], false));
expect(vcsOps.saveAll).toHaveBeenCalled();
expect(commands.svnMerge).not.toHaveBeenCalled();
});
it("reverse-merges a single Subversion revision via svnRevertRevision", async () => {
vi.mocked(commands.svnRevertRevision).mockResolvedValueOnce({
status: "ok",
data: { updated: 0, added: 0, deleted: 1, conflicted: 0, output: ["D feat.txt"] },
});
await svnRevertRevision("/wc", "r12");
expect(vcsOps.saveAll).toHaveBeenCalled();
expect(commands.svnRevertRevision).toHaveBeenCalledWith("/wc", expect.any(Number), 12, expect.anything());
});
});
+9 -1
Переглянути файл
@@ -83,7 +83,15 @@ describe("the Git feature's actions for a Subversion working copy", () => {
it("offers Subversion's own actions only there", () => {
withActions(() => {
for (const id of ["svn.cleanup", "svn.lock", "svn.unlock", "svn.relocate", "svn.properties"]) {
for (const id of [
"svn.merge",
"svn.revertRevision",
"svn.cleanup",
"svn.lock",
"svn.unlock",
"svn.relocate",
"svn.properties",
]) {
const action = getAction(id)!;
expect(isActionVisible(action, SVN) && isActionEnabled(action, SVN), id).toBe(true);
expect(isActionVisible(action, GIT), id).toBe(false);
+29
Переглянути файл
@@ -137,6 +137,8 @@ import { tx } from "@/platform/i18n";
import { addToIgnore } from "./ignore";
import { gateByVcsKind, SUBVERSION } from "./vcsKind";
import { commitArg } from "./historyActions";
import { openSvnMergeDialog, svnRevertRevision } from "./svnMerge";
import { showSvnProperties, svnCleanup, svnLock, svnRelocate, svnUnlock } from "./svn";
import { hasFileHistory, showCurrentRevision, trackFileHistory } from "./fileRevisions";
@@ -1288,6 +1290,33 @@ export function registerVcsActions(): () => void {
keywords: ["ignore", "unversioned", "exclude"],
run: ({ arg, ctx }) => addToIgnore(focusedPaths(arg, ctx), destination),
})),
{
id: "svn.merge",
title: "Merge From…",
category: "Subversion",
when: `${VCS} && ${SUBVERSION}`,
visibleWhen: SUBVERSION,
keywords: ["svn", "reintegrate", "eligible"],
run: ({ arg }) => openSvnMergeDialog(rootOfKind(operationRepo(arg), "subversion")),
},
{
id: "svn.revertRevision",
title: "Reverse Merge Revision",
category: "Subversion",
when: `${VCS} && ${SUBVERSION}`,
visibleWhen: SUBVERSION,
keywords: ["svn", "undo commit", "revert revision"],
run: ({ arg }) => {
const raw =
arg && typeof arg === "object" && "kind" in arg && arg.kind === "file-history-commit" && "commit" in arg
? (arg as { commit: unknown }).commit
: arg;
const c = commitArg(raw);
if (!c) return;
const repo = rootOfKind(commitRepo(c) ?? operationRepo(arg), "subversion");
void svnRevertRevision(repo, c.id);
},
},
{
id: "svn.cleanup",
title: "Cleanup",
+4
Переглянути файл
@@ -38,6 +38,7 @@ export function commitMenu(c: Commit, selection: Commit[] = [c], fileHistoryTarg
const branchInfo = repo ? vcs.heads[repo] : vcs.branch;
const head = branchInfo?.head ?? null;
const operation = repo ? vcs.operations[repo] : vcs.branch?.operation;
const isSvn = vcsKindOf(repo ?? currentRepoRoot()) === "subversion";
const cannotApply = !canApplyCommits(commits);
const compareArg: Commit[] | FileHistoryCommitsArg = fileHistoryTarget
? { kind: "file-history-commits", commits: selection, target: fileHistoryTarget }
@@ -121,6 +122,9 @@ export function commitMenu(c: Commit, selection: Commit[] = [c], fileHistoryTarg
{ kind: "separator" },
single("vcs.log.resetToHere", { icon: "revert" }),
{ kind: "action", action: "vcs.log.revert", arg: many ? selection : c, icon: null, disabled: cannotApply },
...(isSvn && !many
? [{ kind: "action" as const, action: "svn.revertRevision", arg: actionCommit, icon: null }]
: []),
// Editing one commit is hidden, not disabled, for a multiple selection.
...(many
? []
+81
Переглянути файл
@@ -44,3 +44,84 @@
margin: 0;
color: var(--danger);
}
.modeTabs {
display: flex;
gap: var(--space-1);
}
.inlineRow {
display: flex;
align-items: center;
gap: var(--space-2);
}
.grow {
flex: 1 1 auto;
min-width: 0;
}
.eligibleList {
display: flex;
flex-direction: column;
gap: var(--space-1);
max-height: 220px;
overflow-y: auto;
padding: var(--space-1);
border: 1px solid var(--border);
border-radius: var(--radius-control, 4px);
}
.eligibleRow {
display: flex;
align-items: center;
gap: var(--space-2);
padding: var(--space-1) var(--space-2);
border-radius: var(--radius-control, 4px);
font-size: var(--fs-ui);
cursor: pointer;
}
.eligibleRow:hover {
background: var(--bg-hover, var(--bg-button));
}
.badge {
font-family: var(--font-mono);
font-size: var(--fs-small);
color: var(--fg-secondary);
}
.metaCell {
color: var(--fg-secondary);
font-size: var(--fs-small);
white-space: nowrap;
}
.path {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.emptyBox {
display: flex;
justify-content: center;
padding: var(--space-3);
color: var(--fg-secondary);
font-size: var(--fs-small);
}
.logBox {
max-height: 140px;
overflow: auto;
padding: var(--space-2);
border-radius: var(--radius-control, 4px);
background: var(--bg-field, var(--bg-button));
font-family: var(--font-mono);
font-size: var(--fs-small);
white-space: pre-wrap;
color: var(--fg-secondary);
}
+524
Переглянути файл
@@ -0,0 +1,524 @@
/** Subversion Merge From… dialog and Log Reverse Merge helper. */
import { Channel } from "@tauri-apps/api/core";
import { useEffect, useMemo, useState } from "react";
import type { SvnDepth, SvnEligibleRevision, SvnMergeResult } from "@/bindings";
import { executeAction } from "@/platform/actions";
import { tx } from "@/platform/i18n";
import { call, commands, nextRequestId } from "@/platform/ipc";
import { Button, Checkbox, Dialog, Input, Select, Spinner, T } from "@/ui";
import { notifications } from "@/workbench/contributions";
import { groupOf } from "./changes";
import commonStyles from "./common.module.css";
import { openDialog } from "./dialogs";
import { rootOf } from "./model";
import { errorMessage, logConsole, saveAll } from "./ops";
import { refreshNow, useVcs } from "./store";
import styles from "./svn.module.css";
type MergeMode = "all" | "select" | "reintegrate";
type WhitespaceIgnoreMode = "" | "change" | "all" | "eol";
const EMPTY_REVS: ReadonlySet<number> = new Set();
const MERGE_WHITESPACE_OPTIONS: { value: WhitespaceIgnoreMode; label: string }[] = [
{ value: "", label: "Compare all whitespaces" },
{ value: "change", label: "Ignore whitespace changes" },
{ value: "all", label: "Ignore all whitespace" },
{ value: "eol", label: "Ignore end-of-line differences" },
];
const MERGE_DEPTH_OPTIONS: { value: SvnDepth | ""; label: string }[] = [
{ value: "", label: "Working copy depth (keep current)" },
{ value: "infinity", label: "Infinity (full recursion)" },
{ value: "immediates", label: "Immediates (direct children)" },
{ value: "files", label: "Files (direct file children)" },
{ value: "empty", label: "Empty (target only)" },
];
const ELIGIBLE_PAGE_SIZE = 200;
async function confirmLocalChangesBeforeSvnMerge(repo: string | null): Promise<boolean> {
await saveAll();
await refreshNow();
const { status, roots, repo: activeRepo } = useVcs.getState();
const targetRepo = repo ?? activeRepo ?? roots[0] ?? null;
const dirtyPaths = status
.filter((file) => {
if (groupOf(file) !== "changes") return false;
if (!targetRepo) return true;
return rootOf(file.path, roots) === targetRepo;
})
.map((file) => file.relPath);
if (dirtyPaths.length === 0) return true;
const { reviewLocalChanges } = await import("./LocalChangesReviewDialog");
const decision = await reviewLocalChanges("svnMerge", [[targetRepo, dirtyPaths]], false);
return decision !== null;
}
/** Formats Subversion merge revision specs (`100:120` -> `-r 100:120`, `105, 108` -> `-c 105,108`). */
export function formatSvnMergeRevisionFlags(raw: string): string | null {
const parts = raw
.split(",")
.map((p) => p.replace(/^-c\s*/i, "").trim())
.filter(Boolean);
if (!parts.length) return null;
const singleRevs: string[] = [];
const flags: string[] = [];
for (const part of parts) {
const rangeMatch = /^[rR]?(\d+)\s*[-:]\s*[rR]?(\d+)$/.exec(part);
if (rangeMatch) {
if (singleRevs.length) {
flags.push(`-c ${singleRevs.join(",")}`);
singleRevs.length = 0;
}
flags.push(`-r ${rangeMatch[1]}:${rangeMatch[2]}`);
} else if (/^[rR]?\d+$/.test(part)) {
singleRevs.push(part.replace(/^[rR]/, ""));
} else {
return null;
}
}
if (singleRevs.length) flags.push(`-c ${singleRevs.join(",")}`);
return flags.join(" ");
}
export function openSvnMergeDialog(repo: string | null, initialSourceUrl?: string, initialRevisions?: string) {
openDialog((close) => (
<SvnMergeDialog
repo={repo}
initialSourceUrl={initialSourceUrl}
initialRevisions={initialRevisions}
onClose={close}
/>
));
}
export async function svnRevertRevision(repo: string | null, revisionRaw: string) {
const rev = Number.parseInt(revisionRaw.trim().replace(/^[rR]/, ""), 10);
if (!Number.isFinite(rev) || rev <= 0) {
notifications().notify({ group: "vcs", level: "error", title: tx`Invalid Subversion revision: ${revisionRaw}` });
return;
}
if (!(await confirmLocalChangesBeforeSvnMerge(repo))) return;
const req = nextRequestId();
const channel = new Channel<string>();
logConsole("cmd", `svn merge -c -${rev}`);
channel.onmessage = (line) => {
const trimmed = line.trimEnd();
if (trimmed) logConsole("out", trimmed);
};
try {
const res = await call(commands.svnRevertRevision(repo, req, rev, channel));
await refreshNow();
if (res.conflicted > 0) {
notifications().notify({
group: "vcs",
level: "warning",
title: tx`Reverse merge of r${rev} left ${res.conflicted} conflicts`,
actions: repo
? [{ label: tx("Resolve…"), run: () => void executeAction("vcs.resolveConflicts", { repositories: [repo] }) }]
: undefined,
});
} else {
notifications().notify({ group: "vcs", level: "info", title: tx`Reverse-merged r${rev} into working copy` });
}
} catch (e) {
notifications().notify({
group: "vcs",
level: "error",
title: tx("Reverse Merge failed"),
body: errorMessage(e),
});
}
}
export function SvnMergeDialog({
repo,
initialSourceUrl,
initialRevisions,
onClose,
}: {
repo: string | null;
initialSourceUrl?: string;
initialRevisions?: string;
onClose: () => void;
}) {
const [sourceUrl, setSourceUrl] = useState(initialSourceUrl ?? "");
const [mode, setMode] = useState<MergeMode>(initialRevisions ? "select" : "all");
const [revisions, setRevisions] = useState(initialRevisions ?? "");
const [revSelection, setRevSelection] = useState<{ source: string; revs: Set<number> }>(() => ({
source: (initialSourceUrl ?? "").trim(),
revs: new Set(),
}));
const [revFilter, setRevFilter] = useState("");
const [eligibleState, setEligibleState] = useState<{
key: string;
items: SvnEligibleRevision[];
hasMore: boolean;
total: number;
loadingMore: boolean;
error: string | null;
}>({ key: "", items: [], hasMore: false, total: 0, loadingMore: false, error: null });
const [eligibleTick, setEligibleTick] = useState(0);
const [dryRun, setDryRun] = useState(false);
const [recordOnly, setRecordOnly] = useState(false);
const [ignoreAncestry, setIgnoreAncestry] = useState(false);
const [force, setForce] = useState(false);
const [ignoreWhitespace, setIgnoreWhitespace] = useState<WhitespaceIgnoreMode>("");
const [depth, setDepth] = useState<SvnDepth | "">("");
const [branchUrls, setBranchUrls] = useState<{ value: string; label: string }[]>([]);
const [result, setResult] = useState<SvnMergeResult | null>(null);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
let alive = true;
void call(commands.svnMergeSources(repo)).then(
(sources) => {
if (!alive) return;
const opts = sources.map((s) => ({
value: s.url,
label: s.current ? tx`${s.name} (current)` : s.name,
}));
setBranchUrls(opts);
const trunk = sources.find((s) => s.name === "trunk");
if (!initialSourceUrl && trunk) {
setSourceUrl(trunk.url);
}
},
() => {
if (alive) setBranchUrls([]);
},
);
return () => {
alive = false;
};
}, [repo, initialSourceUrl]);
const trimmedSource = sourceUrl.trim();
const selectedRevs: ReadonlySet<number> = revSelection.source === trimmedSource ? revSelection.revs : EMPTY_REVS;
const eligibleKey = mode === "select" && trimmedSource ? `${repo ?? ""}::${trimmedSource}::${eligibleTick}` : "";
useEffect(() => {
if (!eligibleKey) return;
let alive = true;
const req = nextRequestId();
void call(commands.svnEligibleRevisions(repo, trimmedSource, ELIGIBLE_PAGE_SIZE, null, req)).then(
(page) => {
if (alive) {
setEligibleState({
key: eligibleKey,
items: page.items,
hasMore: page.hasMore,
total: page.total,
loadingMore: false,
error: null,
});
}
},
(e) => {
if (alive) {
setEligibleState({
key: eligibleKey,
items: [],
hasMore: false,
total: 0,
loadingMore: false,
error: errorMessage(e),
});
}
},
);
return () => {
alive = false;
};
}, [eligibleKey, repo, trimmedSource]);
const eligibleLoading = !!eligibleKey && eligibleState.key !== eligibleKey;
const loadMoreEligible = async () => {
if (!eligibleKey || eligibleState.loadingMore || !eligibleState.hasMore || !eligibleState.items.length) return;
const oldest = eligibleState.items[eligibleState.items.length - 1]!.revision;
const activeKey = eligibleKey;
setEligibleState((prev) => (prev.key === activeKey ? { ...prev, loadingMore: true } : prev));
try {
const page = await call(
commands.svnEligibleRevisions(repo, trimmedSource, ELIGIBLE_PAGE_SIZE, oldest, nextRequestId()),
);
setEligibleState((prev) => {
if (prev.key !== activeKey) return prev;
const seen = new Set(prev.items.map((item) => item.revision));
const appended = page.items.filter((item) => !seen.has(item.revision));
return {
...prev,
items: [...prev.items, ...appended],
hasMore: page.hasMore,
total: page.total,
loadingMore: false,
};
});
} catch (e) {
setEligibleState((prev) =>
prev.key === activeKey ? { ...prev, loadingMore: false, error: errorMessage(e) } : prev,
);
}
};
const filteredEligible = useMemo(() => {
const q = revFilter.trim().toLowerCase();
if (!q) return eligibleState.items;
return eligibleState.items.filter(
(r) => `r${r.revision}`.includes(q) || r.author.toLowerCase().includes(q) || r.message.toLowerCase().includes(q),
);
}, [eligibleState.items, revFilter]);
const toggleRev = (rev: number) => {
setRevSelection((prev) => {
const base = prev.source === trimmedSource ? prev.revs : EMPTY_REVS;
const next = new Set(base);
if (next.has(rev)) next.delete(rev);
else next.add(rev);
return { source: trimmedSource, revs: next };
});
};
const submit = async () => {
if (busy) return;
if (!trimmedSource) {
setError(tx("Select or enter a merge source URL"));
return;
}
const checkedRevList = [...selectedRevs].sort((a, b) => a - b).join(",");
const revArg = mode === "select" ? revisions.trim() || checkedRevList || null : null;
if (mode === "select" && !revArg) {
setError(tx("Select at least one revision or enter a revision range"));
return;
}
const revFlags = revArg ? formatSvnMergeRevisionFlags(revArg) : null;
if (revArg && !revFlags) {
setError(tx("Enter revisions like 100:120 or 105,108"));
return;
}
setBusy(true);
setError(null);
if (!dryRun && !(await confirmLocalChangesBeforeSvnMerge(repo))) {
setBusy(false);
return;
}
const req = nextRequestId();
const channel = new Channel<string>();
logConsole(
"cmd",
`svn merge${mode === "reintegrate" ? " --reintegrate" : ""}${revFlags ? ` ${revFlags}` : ""} ${trimmedSource}`,
);
channel.onmessage = (line) => {
const trimmed = line.trimEnd();
if (trimmed) logConsole("out", trimmed);
};
try {
const res = await call(
commands.svnMerge(
repo,
req,
{
sourceUrl: trimmedSource,
revisions: revArg,
reintegrate: mode === "reintegrate",
dryRun,
recordOnly,
ignoreAncestry,
force,
ignoreWhitespace: ignoreWhitespace || null,
depth: depth || null,
},
channel,
),
);
setResult(res);
if (!dryRun) {
await refreshNow();
if (res.conflicted > 0) {
notifications().notify({
group: "vcs",
level: "warning",
title: tx`Merge finished with ${res.conflicted} conflicts`,
actions: repo
? [
{
label: tx("Resolve…"),
run: () => void executeAction("vcs.resolveConflicts", { repositories: [repo] }),
},
]
: undefined,
});
} else {
notifications().notify({
group: "vcs",
level: "info",
title: tx`Merged from ${trimmedSource}`,
});
}
onClose();
}
} catch (e) {
setError(errorMessage(e));
} finally {
setBusy(false);
}
};
return (
<Dialog
open
title={repo ? tx`Merge From (${repo})` : tx("Merge From")}
onClose={busy ? () => {} : onClose}
buttons={[
{ label: "Cancel", role: "cancel", disabled: busy },
{ label: busy ? "Merging…" : "Merge", role: "default", onClick: () => void submit(), disabled: busy },
]}
width={620}
>
<div className={commonStyles.form}>
{branchUrls.length > 0 && (
<div className={commonStyles.inlinePrompt}>
<span className={commonStyles.fieldLabel}>
<T>Source branch</T>
</span>
<Select
value={branchUrls.some((c) => c.value === sourceUrl) ? sourceUrl : ""}
onChange={(v) => {
if (v) setSourceUrl(v);
}}
options={[{ value: "", label: tx("(custom URL)") }, ...branchUrls]}
/>
</div>
)}
<div className={commonStyles.inlinePrompt}>
<span className={commonStyles.fieldLabel}>
<T>Source URL</T>
</span>
<Input
mono
value={sourceUrl}
onChange={(e) => setSourceUrl(e.target.value)}
placeholder="https://svn.example.com/repos/project/branches/feature"
/>
</div>
<div className={styles.modeTabs}>
<Button variant={mode === "all" ? "primary" : undefined} onClick={() => setMode("all")}>
<T>Merge All</T>
</Button>
<Button variant={mode === "select" ? "primary" : undefined} onClick={() => setMode("select")}>
<T>Select Revisions</T>
</Button>
<Button variant={mode === "reintegrate" ? "primary" : undefined} onClick={() => setMode("reintegrate")}>
<T>Reintegrate Branch</T>
</Button>
</div>
{mode === "select" && (
<div className={commonStyles.form}>
<div className={styles.inlineRow}>
<Input
className={styles.grow}
value={revFilter}
onChange={(e) => setRevFilter(e.target.value)}
placeholder={tx("Filter eligible revisions…")}
/>
<Button onClick={() => setEligibleTick((t) => t + 1)} disabled={eligibleLoading || !trimmedSource}>
<T>Refresh</T>
</Button>
</div>
<div className={styles.eligibleList}>
{eligibleLoading ? (
<div className={styles.emptyBox}>
<Spinner />
</div>
) : eligibleState.error ? (
<div className={commonStyles.error}>{eligibleState.error}</div>
) : filteredEligible.length === 0 ? (
<div className={styles.emptyBox}>
<T>No eligible revisions reported for this source URL</T>
</div>
) : (
<>
{filteredEligible.map((item) => (
<label key={item.revision} className={styles.eligibleRow}>
<Checkbox checked={selectedRevs.has(item.revision)} onChange={() => toggleRev(item.revision)} />
<span className={styles.badge}>r{item.revision}</span>
<span className={styles.metaCell}>{item.author}</span>
<span className={styles.path} title={item.message}>
{item.message || tx("(no comment)")}
</span>
</label>
))}
{eligibleState.hasMore && (
<div className={styles.inlineRow}>
<Button onClick={() => void loadMoreEligible()} disabled={eligibleState.loadingMore}>
{eligibleState.loadingMore ? tx("Loading…") : tx("Load older revisions…")}
</Button>
</div>
)}
</>
)}
</div>
<div className={commonStyles.inlinePrompt}>
<span className={commonStyles.fieldLabel}>
<T>Or enter revision / range</T>
</span>
<Input
mono
value={revisions}
onChange={(e) => setRevisions(e.target.value)}
placeholder="100:120 or 105,108"
/>
</div>
</div>
)}
<Checkbox
checked={recordOnly}
onChange={setRecordOnly}
label="Only record merge in svn:mergeinfo (--record-only)"
/>
<Checkbox checked={ignoreAncestry} onChange={setIgnoreAncestry} label="Ignore ancestry" />
<Checkbox checked={force} onChange={setForce} label="Force merge" />
<div className={commonStyles.inlinePrompt}>
<span className={commonStyles.fieldLabel}>
<T>Whitespace handling</T>
</span>
<Select
value={ignoreWhitespace}
onChange={(v) => setIgnoreWhitespace(v as WhitespaceIgnoreMode)}
options={MERGE_WHITESPACE_OPTIONS}
/>
</div>
<div className={commonStyles.inlinePrompt}>
<span className={commonStyles.fieldLabel}>
<T>Depth</T>
</span>
<Select
aria-label={tx("Depth")}
value={depth}
onChange={(v) => setDepth(v as SvnDepth | "")}
options={MERGE_DEPTH_OPTIONS}
/>
</div>
<Checkbox checked={dryRun} onChange={setDryRun} label="Dry run (test merge without modifying files)" />
{result && (
<div className={styles.logBox}>
{result.output.length > 0
? result.output.join("\n")
: tx`Updated: ${result.updated}, Added: ${result.added}, Deleted: ${result.deleted}, Conflicted: ${result.conflicted}`}
</div>
)}
{error && <div className={commonStyles.error}>{error}</div>}
</div>
</Dialog>
);
}
+1
Переглянути файл
@@ -393,6 +393,7 @@
"menu.vcs.initSubmodules": "Initialize Submodules",
"menu.vcs.syncSubmodules": "Sync Submodule URLs",
"menu.subversion": "Subversion",
"menu.svn.merge": "Merge From…",
"menu.svn.cleanup": "Cleanup",
"menu.svn.lock": "Lock…",
"menu.svn.unlock": "Unlock",
+46
Переглянути файл
@@ -5202,6 +5202,52 @@
"Code insight for {container} reads its last build. Without one yet, it is built in the background.": "Code insight for {container} reads its last build. Without one yet, it is built in the background.",
"Background build for code insight failed": "Background build for code insight failed",
"Code insight reads what it built. Run shows the whole build log.": "Code insight reads what it built. Run shows the whole build log.",
"{name} (current)": "{name} (current)",
"Merge From…": "Merge From…",
"Reverse Merge Revision": "Reverse Merge Revision",
"Compare all whitespaces": "Compare all whitespaces",
"Ignore whitespace changes": "Ignore whitespace changes",
"Ignore all whitespace": "Ignore all whitespace",
"Ignore end-of-line differences": "Ignore end-of-line differences",
"Invalid Subversion revision: {revisionRaw}": "Invalid Subversion revision: {revisionRaw}",
"Reverse merge of r{rev} left {conflicted} conflicts": "Reverse merge of r{rev} left {conflicted} conflicts",
"Reverse-merged r{rev} into working copy": "Reverse-merged r{rev} into working copy",
"Reverse Merge failed": "Reverse Merge failed",
"Select or enter a merge source URL": "Select or enter a merge source URL",
"Select at least one revision or enter a revision range": "Select at least one revision or enter a revision range",
"Enter revisions like 100:120 or 105,108": "Enter revisions like 100:120 or 105,108",
"Merge finished with {conflicted} conflicts": "Merge finished with {conflicted} conflicts",
"Merged from {trimmedSource}": "Merged from {trimmedSource}",
"Merge From ({repo})": "Merge From ({repo})",
"Merge From": "Merge From",
"Merging…": "Merging…",
"Source branch": "Source branch",
"(custom URL)": "(custom URL)",
"Source URL": "Source URL",
"Merge All": "Merge All",
"Select Revisions": "Select Revisions",
"Reintegrate Branch": "Reintegrate Branch",
"Filter eligible revisions…": "Filter eligible revisions…",
"No eligible revisions reported for this source URL": "No eligible revisions reported for this source URL",
"(no comment)": "(no comment)",
"Or enter revision / range": "Or enter revision / range",
"100:120 or 105,108": "100:120 or 105,108",
"Only record merge in svn:mergeinfo (--record-only)": "Only record merge in svn:mergeinfo (--record-only)",
"Ignore ancestry": "Ignore ancestry",
"Force merge": "Force merge",
"Whitespace handling": "Whitespace handling",
"Dry run (test merge without modifying files)": "Dry run (test merge without modifying files)",
"Updated: {updated}, Added: {added}, Deleted: {deleted}, Conflicted: {conflicted}": "Updated: {updated}, Added: {added}, Deleted: {deleted}, Conflicted: {conflicted}",
"Subversion Local Changes": "Subversion Local Changes",
"There are uncommitted local changes in this working copy. Review or roll them back before merging, or continue anyway.": "There are uncommitted local changes in this working copy. Review or roll them back before merging, or continue anyway.",
"The listed local changes are gone. You can retry merging.": "The listed local changes are gone. You can retry merging.",
"Working copy depth (keep current)": "Working copy depth (keep current)",
"Infinity (full recursion)": "Infinity (full recursion)",
"Immediates (direct children)": "Immediates (direct children)",
"Files (direct file children)": "Files (direct file children)",
"Empty (target only)": "Empty (target only)",
"Load older revisions…": "Load older revisions…",
"Depth": "Depth",
"Increase Preview Font Size": "Increase Preview Font Size",
"Decrease Preview Font Size": "Decrease Preview Font Size",
"Open Dev Container Configuration": "Open Dev Container Configuration",
+45
Переглянути файл
@@ -12097,6 +12097,51 @@
"The project was not added to the solution": "项目未添加到解决方案",
"The solution already contains a project with the same name as {names}.": "解决方案中已有与 {names} 同名的项目。",
"Language server updates are available": "语言服务器有可用更新",
"{name} (current)": "{name}(当前)",
"Merge From…": "合并自…",
"Reverse Merge Revision": "反向合并修订版本",
"Compare all whitespaces": "比较所有空白",
"Ignore whitespace changes": "忽略空白更改",
"Ignore all whitespace": "忽略所有空白",
"Ignore end-of-line differences": "忽略行尾差异",
"Invalid Subversion revision: {revisionRaw}": "无效的 Subversion 修订号:{revisionRaw}",
"Reverse merge of r{rev} left {conflicted} conflicts": "反向合并 r{rev} 后存在 {conflicted} 个冲突",
"Reverse-merged r{rev} into working copy": "已将 r{rev} 反向合并到工作副本",
"Reverse Merge failed": "反向合并失败",
"Select or enter a merge source URL": "请选择或输入合并源 URL",
"Select at least one revision or enter a revision range": "请至少选择一个修订版或输入修订范围",
"Enter revisions like 100:120 or 105,108": "请输入如 100:120 或 105,108 的修订范围",
"Merge finished with {conflicted} conflicts": "合并完成,存在 {conflicted} 个冲突",
"Merged from {trimmedSource}": "已从 {trimmedSource} 合并",
"Merge From ({repo})": "合并自 ({repo})",
"Merge From": "合并自",
"Merging…": "正在合并…",
"Source branch": "源分支",
"(custom URL)": "(自定义 URL)",
"Source URL": "源 URL",
"Merge All": "全部合并",
"Select Revisions": "选择修订版",
"Reintegrate Branch": "重新集成分支",
"Filter eligible revisions…": "筛选可合并修订版…",
"No eligible revisions reported for this source URL": "此源 URL 没有可合并的修订版",
"(no comment)": "(无说明)",
"Or enter revision / range": "或输入修订号 / 范围",
"100:120 or 105,108": "100:120 或 105,108",
"Only record merge in svn:mergeinfo (--record-only)": "仅在 svn:mergeinfo 中记录合并 (--record-only)",
"Ignore ancestry": "忽略祖先",
"Force merge": "强制合并",
"Whitespace handling": "空白处理",
"Dry run (test merge without modifying files)": "演练(仅测试合并而不修改文件)",
"Updated: {updated}, Added: {added}, Deleted: {deleted}, Conflicted: {conflicted}": "已更新:{updated},已添加:{added},已删除:{deleted},冲突:{conflicted}",
"Subversion Local Changes": "Subversion 本地更改",
"There are uncommitted local changes in this working copy. Review or roll them back before merging, or continue anyway.": "此工作副本中存在未提交的本地更改。请在合并前检查或回滚这些更改,或直接继续。",
"The listed local changes are gone. You can retry merging.": "所列本地更改已清除,您可以重试合并。",
"Working copy depth (keep current)": "工作副本深度(保持当前)",
"Infinity (full recursion)": "Infinity(完全递归)",
"Immediates (direct children)": "Immediates(仅直接子项)",
"Files (direct file children)": "Files(仅直接文件子项)",
"Empty (target only)": "Empty(仅目标自身)",
"Load older revisions…": "加载更早的修订版…",
"Vue Language Server version": "Vue 语言服务器版本",
"Auto uses 3.0.x for Vue 2 projects and the latest release for Vue 3.": "自动选择时,Vue 2 项目使用 3.0.x,Vue 3 项目使用最新版本。",
"Enter latest, 3.0.x, or an exact Vue Language Server version.": "请输入 latest、3.0.x 或 Vue 语言服务器的具体版本。",
+1
Переглянути файл
@@ -393,6 +393,7 @@
"menu.vcs.initSubmodules": "初始化子模块",
"menu.vcs.syncSubmodules": "同步子模块 URL",
"menu.subversion": "Subversion",
"menu.svn.merge": "合并自…",
"menu.svn.cleanup": "清理",
"menu.svn.lock": "锁定…",
"menu.svn.unlock": "解锁",
+1
Переглянути файл
@@ -1784,6 +1784,7 @@ export function gitMenuItems({ paths, dirs, file, ignore, editorSelection }: Git
// What only Subversion has.
...(svn
? [
action("svn.merge", "Merge From…"),
act("svn.lock", "Lock…"),
act("svn.unlock", "Unlock"),
act("svn.properties", "Properties…"),