Fixes five Subversion bugs from #7433:

- Revision details, changed files and annotation summaries ask the working copy's own URL first and the repository root only for revisions it does not list, so a server that authorizes by path no longer refuses them (E170013 / E175013). The branch list asks trunk, branches and tags one by one when the project folder cannot be listed.
- Shelving around Update Project is limited to Git repositories, so updating Subversion working copies no longer reports "not a git repository of the project".
- A double click on a working copy's tree or property conflict keeps it selected in the Conflicts dialog instead of opening the merge editor.
- The diff of a working copy's folder compares its properties instead of failing with W195007.
- The Log's User filter and author tooltip show an author without an email by name alone.

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-12-02 16:44:42 +08:00
1 джерело 1425bfe8ae
коміт 8aacedf5ad
16 files changed
+410 -25

No files matched your search

+39 -14
Переглянути файл
@@ -498,26 +498,51 @@ impl WorkingCopy {
/// Log messages of `revisions`, read in one `svn log -c` per batch.
fn messages(&self, revisions: &[u64]) -> IdeResult<HashMap<u64, LogEntry>> {
let url = self.current_repository().root_url;
let mut out = HashMap::new();
for chunk in revisions.chunks(BATCH) {
let list = chunk.iter().map(u64::to_string).collect::<Vec<_>>().join(",");
let log = self.remote(&[args(["log", "--xml", "-c", &list]), vec![url_target(&url)]].concat(), None)?;
out.extend(xml::log(&log)?.into_iter().map(|e| (e.revision, e)));
}
Ok(out)
self.log_entries(revisions, false)
}
fn revision_entry(&self, revision: u64) -> IdeResult<LogEntry> {
let url = self.current_repository().root_url;
let argv = [args(["log", "--xml", "-v", "-c", &revision.to_string()]), vec![url_target(&url)]].concat();
let out = self.remote(&argv, None)?;
xml::log(&out)?
.into_iter()
.next()
self.log_entries(&[revision], true)?
.remove(&revision)
.ok_or_else(|| IdeError::not_found(format!("revision {revision} does not exist")))
}
/// `svn log -c` of `revisions` (`-v`: with their paths), asked of the working copy's own URL
/// first: a server that authorizes by path may refuse the repository root (E175013) to a
/// user who can read the project. Revisions it does not list (a change outside the working
/// copy's history) are asked of the root. A failure is told only when nothing was read.
fn log_entries(&self, revisions: &[u64], verbose: bool) -> IdeResult<HashMap<u64, LogEntry>> {
let repository = self.current_repository();
let mut urls = vec![repository.url];
if repository.root_url != urls[0] {
urls.push(repository.root_url);
}
let mut out = HashMap::new();
let mut failure = None;
for url in urls {
let missing: Vec<u64> = revisions.iter().copied().filter(|r| !out.contains_key(r)).collect();
for chunk in missing.chunks(BATCH) {
let list = chunk.iter().map(u64::to_string).collect::<Vec<_>>().join(",");
let mut argv = args(["log", "--xml", "-c", &list]);
if verbose {
argv.push("-v".into());
}
argv.push(url_target(&url));
match self.remote(&argv, None).and_then(|log| xml::log(&log)) {
Ok(entries) => out.extend(entries.into_iter().map(|e| (e.revision, e))),
Err(e) => {
failure.get_or_insert(e);
break;
}
}
}
}
match failure {
Some(e) if out.is_empty() && !revisions.is_empty() => Err(e),
_ => Ok(out),
}
}
/// Paths a revision changed, as working-copy paths. A copy whose source the
/// same revision deleted is a rename.
fn revision_files(&self, entry: &LogEntry) -> Vec<ChangedFile> {
+36 -3
Переглянути файл
@@ -4,9 +4,10 @@
//! Commands that may meet a conflict pass `--accept postpone`: in interactive
//! mode svn would otherwise ask how to resolve it on the terminal it does not have.
use crate::cli::{REMOTE, Svn, SvnContext, args, is_absent, target, url_target};
use crate::cli::{REMOTE, Svn, SvnContext, args, is_absent, is_login_required, target, url_target};
use crate::workspace::{BATCH, Layout, WorkingCopy};
use crate::xml;
use ide_core::error::ErrorKind;
use ide_core::{CancellationToken, IdeError, IdeResult};
use std::ffi::OsString;
use std::io::Write;
@@ -307,8 +308,20 @@ impl WorkingCopy {
let mut lines = Vec::new();
let list =
|url: &str| self.remote(&[args(["list", "--xml", "--"]), vec![url_target(url)]].concat(), Some(cancel));
let top = xml::lists(&list(&base)?)?;
let folders: Vec<xml::ListEntry> = top.into_iter().flat_map(|(_, e)| e).filter(|e| e.kind == "dir").collect();
let folders: Vec<xml::ListEntry> = match list(&base) {
Ok(out) => xml::lists(&out)?.into_iter().flat_map(|(_, e)| e).filter(|e| e.kind == "dir").collect(),
// A server that authorizes by path may refuse the project folder (or, at the
// repository root, the root) while `trunk`, `branches` and `tags` are readable: each
// is asked on its own. svnserve refuses a path as it asks for a login (E170001).
Err(e) if e.kind == ErrorKind::PermissionDenied || is_login_required(&e) => {
let found = self.readable_lines(&base, cancel);
if found.is_empty() {
return Err(e);
}
found
}
Err(e) => return Err(e),
};
let line = |name: String, entry: &xml::ListEntry| ide_vcs::Branch {
current: name == layout.line,
name,
@@ -339,6 +352,26 @@ impl WorkingCopy {
Ok(lines)
}
/// `trunk`, `branches` and `tags` of `base` that can be read, as `svn list` of `base` would
/// list them.
fn readable_lines(&self, base: &str, cancel: &CancellationToken) -> Vec<xml::ListEntry> {
["trunk", "branches", "tags"]
.into_iter()
.filter_map(|name| {
let url = format!("{base}/{name}");
let out = self.remote(&[args(["info", "--xml", "--"]), vec![url_target(&url)]].concat(), Some(cancel));
let info = xml::info(&out.ok()?).ok()?.into_iter().next()?;
(info.kind == "dir").then(|| xml::ListEntry {
name: name.to_owned(),
kind: info.kind,
size: None,
revision: info.last_changed_revision,
time_ms: info.last_changed_ms,
})
})
.collect()
}
/// 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> {
+26
Переглянути файл
@@ -476,6 +476,11 @@ impl WorkingCopy {
}
pub(crate) fn bytes_at(&self, path: &Path, rev: &Rev) -> IdeResult<Option<Vec<u8>>> {
// A folder has no text for `svn cat` (W195007): its side of a diff is its properties,
// where a folder's own change is.
if path.is_dir() {
return self.folder_properties(path, rev);
}
let result = match rev {
Rev::Working => return Ok(std::fs::read(path).ok()),
// The pristine copy; for a copy or a move, that of its source.
@@ -489,6 +494,27 @@ impl WorkingCopy {
}
}
/// A folder's properties at `rev` as text, a `name = value` line each, sorted by name.
fn folder_properties(&self, path: &Path, rev: &Rev) -> IdeResult<Option<Vec<u8>>> {
let head = ["proplist", "-v", "--xml"];
let result = match rev {
Rev::Working => self.run(&[args(head), vec![target(path)]].concat()),
Rev::Base => self.run(&[args(head), args(["-r", "BASE"]), vec![target(path)]].concat()),
Rev::Other(rev) => self.pegged_at(&head, path, rev, None),
};
let mut properties = match result {
Ok(out) => xml::properties(&out)?,
Err(e) if is_absent(&e) => return Ok(None),
Err(e) => return Err(e),
};
properties.sort();
let text: String = properties
.into_iter()
.map(|(name, value)| format!("{name} = {}\n", value.strip_suffix('\n').unwrap_or(&value)))
.collect();
Ok(Some(text.into_bytes()))
}
/// `command -r rev path`, which follows the file back through renames from
/// its base; for a revision newer than the base, the path as it is there
/// (`path@rev`).
+5
Переглянути файл
@@ -248,6 +248,9 @@ pub struct Info {
pub conflict_files: Vec<String>,
pub conflicts: Vec<Conflict>,
pub lock: Option<Lock>,
/// The last revision that changed this path, and when.
pub last_changed_revision: Option<u64>,
pub last_changed_ms: f64,
}
pub(crate) fn info(xml: &[u8]) -> IdeResult<Vec<Info>> {
@@ -308,6 +311,8 @@ pub(crate) fn info(xml: &[u8]) -> IdeResult<Vec<Info>> {
conflict_files,
conflicts,
lock: entry.child("lock").map(lock),
last_changed_revision: entry.child("commit").and_then(|c| c.attr("revision")?.parse().ok()),
last_changed_ms: entry.child("commit").and_then(|c| time_ms(c.text_of("date"))).unwrap_or(0.0),
}
})
.collect())
+32
Переглянути файл
@@ -753,3 +753,35 @@ fn the_password_prompt_after_the_user_name_names_the_server() {
}
}
}
/// A server that authorizes by path (issue #7433): the repository root cannot be read, the
/// project's lines can. A revision's details, its files, annotations and the branch list read
/// only what the user may.
#[test]
fn reads_of_a_server_that_refuses_the_repository_root() {
if !have(&["svnserve"]) {
return;
}
let Some(repo) = repo() else { return };
let setup = repo.checkout("setup");
write(&setup, "a.txt", "one\n");
repo.svn(setup.root(), &["add", "-q", "a.txt"]);
assert_eq!(commit(&setup, &[], "first line"), "2");
let (trunk, branch) = (format!("{}/trunk", repo.url), format!("{}/branches/b1", repo.url));
repo.svn(&repo.base, &["copy", "-q", "-m", "branch", &trunk, &branch]);
let dir = repo.base.join("repo");
std::fs::write(dir.join("conf/authz"), "[/]\n* =\n[/trunk]\n* = r\n[/branches]\n* = r\n").unwrap();
std::fs::write(dir.join("conf/svnserve.conf"), "[general]\nanon-access = read\nauthz-db = authz\n").unwrap();
let (_server, url) = svnserve(&dir);
let dest = repo.base.join("wc");
repo.svn(&repo.base, &["checkout", "-q", &format!("{url}/trunk"), dest.to_str().unwrap()]);
let wc = WorkingCopy::discover(&dest, ctx()).unwrap().expect("a working copy");
assert_eq!(wc.log_details("2").unwrap().message, "first line");
let files: Vec<String> = wc.commit_files("2").unwrap().into_iter().map(|f| f.path).collect();
assert_eq!(files, ["a.txt"]);
let blame = wc.blame(&dest.join("a.txt"), None, None, utf8()).unwrap();
assert_eq!((blame[0].commit.as_str(), blame[0].summary.as_str()), ("2", "first line"));
let lines: Vec<String> = wc.lines(&CancellationToken::new()).unwrap().into_iter().map(|b| b.name).collect();
assert_eq!(lines, ["trunk", "branches/b1"]);
}
+17
Переглянути файл
@@ -1142,3 +1142,20 @@ fn a_base_size_without_pristine_copies() {
repo.svn(bare.root(), &["move", "-q", "a.bin", "moved.bin"]);
assert_eq!(bare.file_size_at(&bare.root().join("moved.bin"), Some("HEAD")).unwrap(), Some(7));
}
/// Issue #7433: a folder's own row (its properties changed, the working copy's root here) diffs
/// its properties: `svn cat` has no text for a folder (W195007).
#[test]
fn a_folder_diffs_its_properties() {
let Some(repo) = repo() else { return };
let wc = repo.checkout("wc");
repo.svn(wc.root(), &["propset", "-q", "svn:ignore", "target\n", "."]);
assert_eq!(rows(&wc), [":Modified"]);
let text = |rev| String::from_utf8(wc.file_bytes_at(wc.root(), rev).unwrap().unwrap()).unwrap();
assert_eq!(text(Some("HEAD")), "");
assert_eq!(text(Some("WT")), "svn:ignore = target\n");
commit(&wc, &[wc.root().to_path_buf()], "ignore target");
repo.svn(wc.root(), &["propset", "-q", "svn:ignore", "build\n", "."]);
assert_eq!(text(Some("HEAD")), "svn:ignore = target\n");
assert_eq!(text(Some("r1")), "");
}
+77
Переглянути файл
@@ -0,0 +1,77 @@
import { act, fireEvent, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { ConflictDetail, FileStatus } from "@/bindings";
import { provideEditorService, type EditorService } from "@/workbench/contributions";
const details = vi.hoisted(() => ({}) as Record<string, ConflictDetail[]>);
vi.mock("@/platform/ipc", async (importOriginal) => {
const real = await importOriginal<typeof import("@/platform/ipc")>();
return {
...real,
commands: {
...real.commands,
vcsConflictDetails: (path: string) => Promise.resolve({ status: "ok", data: details[path] ?? [] }),
},
};
});
import { showConflictsDialog } from "../conflictsUi";
import { VcsDialogHost } from "../dialogs";
import { useVcs } from "../store";
const conflicted = (path: string): FileStatus => ({
path,
relPath: path.split("/").pop()!,
staged: null,
unstaged: "conflicted",
renamedFrom: null,
});
const detail = (kind: ConflictDetail["kind"], description: string): ConflictDetail => ({
kind,
description,
property: null,
mine: null,
theirs: null,
incomingDelete: false,
left: null,
right: null,
});
/** A double click as the list sees it: a second click. */
const doubleClick = (row: HTMLElement) => {
fireEvent.click(row, { detail: 1 });
fireEvent.click(row, { detail: 2 });
};
afterEach(() => {
useVcs.setState({ roots: [], kinds: {}, status: [], root: null, repo: null });
for (const key of Object.keys(details)) delete details[key];
});
// Issue #7433: a double click on a working copy's tree conflict opened the merge editor, which
// could only say "has no text conflict".
describe("Conflicts dialog in a working copy", () => {
it("keeps a tree conflict in the dialog and opens a text conflict in the merge editor", async () => {
const openInput = vi.fn(async () => {});
provideEditorService({ openInput } as unknown as EditorService);
details["/p/AGENTS.md"] = [detail("tree", "local file edit, incoming file delete upon update")];
details["/p/context.xml"] = [detail("text", "")];
useVcs.setState({
root: "/p",
repo: "/p",
roots: ["/p"],
kinds: { "/p": "subversion" },
status: [conflicted("/p/AGENTS.md"), conflicted("/p/context.xml")],
});
render(<VcsDialogHost />);
act(() => showConflictsDialog());
doubleClick(await screen.findByText("AGENTS.md"));
await screen.findByText("local file edit, incoming file delete upon update");
expect(openInput).not.toHaveBeenCalled();
expect(screen.getByRole("button", { name: "Merge…" })).toBeDisabled();
doubleClick(screen.getByText("context.xml"));
await vi.waitFor(() => expect(openInput).toHaveBeenCalledOnce());
});
});
+41
Переглянути файл
@@ -0,0 +1,41 @@
import { afterEach, describe, expect, it, vi } from "vitest";
const fileAt = vi.hoisted(() => vi.fn());
vi.mock("@/platform/ipc", async (original) => {
const real = await original<typeof import("@/platform/ipc")>();
return {
...real,
commands: {
...real.commands,
fsReadText: () => Promise.resolve({ status: "error", error: { kind: "invalid", message: "is a directory" } }),
vcsFileAt: (path: string, rev: string) => {
fileAt(path, rev);
return Promise.resolve({ status: "ok", data: "svn:ignore = target\n" });
},
},
};
});
import { readDiffSide } from "../diffInput";
import { useVcs } from "../store";
afterEach(() => {
fileAt.mockReset();
useVcs.setState({ roots: [], kinds: {}, repo: null });
});
// Issue #7433: the row of a working copy's folder (its properties changed) compared nothing on
// the working side, as a folder has no text on disk.
describe("the working side of a folder", () => {
it("is the folder's properties in a Subversion working copy", async () => {
useVcs.setState({ roots: ["/p/boot"], kinds: { "/p/boot": "subversion" }, repo: "/p/boot" });
expect(await readDiffSide("/p/boot", { type: "worktree" })).toBe("svn:ignore = target\n");
expect(fileAt).toHaveBeenCalledExactlyOnceWith("/p/boot", "WT");
});
it("stays unreadable in a Git repository", async () => {
useVcs.setState({ roots: ["/p/app"], kinds: { "/p/app": "git" }, repo: "/p/app" });
expect(await readDiffSide("/p/app/src", { type: "worktree" })).toBeNull();
expect(fileAt).not.toHaveBeenCalled();
});
});
+47
Переглянути файл
@@ -0,0 +1,47 @@
import type { Commit } from "@/bindings";
import { fireEvent, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vitest";
vi.mock("@/platform/ipc", async (importOriginal) => {
const real = await importOriginal<typeof import("@/platform/ipc")>();
return {
...real,
commands: {
...real.commands,
vcsLogUsers: () => Promise.resolve({ status: "ok", data: [] }),
vcsLog: () => Promise.resolve({ status: "ok", data: [] }),
vcsConfigGet: () => Promise.resolve({ status: "ok", data: null }),
},
};
});
import { ContextMenuHost } from "@/ui";
import { FilterBar } from "../log/FilterBar";
import { emptyFilters, useGitLog } from "../logStore";
import { useVcs } from "../store";
const commit = (id: string, author: string, email: string) => ({ id, author, email }) as unknown as Commit;
afterEach(() => {
useGitLog.setState({ filters: emptyFilters(), commits: [] });
useVcs.setState({ root: null, repo: null, roots: [], kinds: {} });
});
// Issue #7433: a Subversion author has no email, and the User filter listed "ly <>", which
// matched no revision.
describe("the Log's User filter", () => {
it("lists an author without an email by name alone", async () => {
useVcs.setState({ root: "/p", repo: "/p", roots: ["/p"], kinds: { "/p": "subversion" } });
useGitLog.setState({ filters: emptyFilters(), commits: [commit("2", "ly", ""), commit("1", "ann", "")] });
render(
<>
<FilterBar />
<ContextMenuHost />
</>,
);
fireEvent.click(screen.getByRole("button", { name: "User" }));
expect(await screen.findByRole("menuitem", { name: "ly" })).toBeInTheDocument();
expect(screen.getByRole("menuitem", { name: "ann" })).toBeInTheDocument();
expect(screen.queryByRole("menuitem", { name: /<>/ })).toBeNull();
});
});
+58
Переглянути файл
@@ -0,0 +1,58 @@
import { afterEach, describe, expect, it, vi } from "vitest";
const finished = vi.hoisted(() => vi.fn());
vi.mock("@/platform/ipc", async (original) => {
const real = await original<typeof import("@/platform/ipc")>();
return {
...real,
isTauri: () => false,
call: async (p: Promise<{ status: string; data?: unknown; error?: unknown }>) => {
const r = await p;
if (r.status === "error") throw r.error;
return r.data;
},
commands: {
...real.commands,
vcsFinishShelfBatch: (batch: string, roots: (string | null)[]) => {
finished(batch, roots);
return Promise.resolve({ status: "ok" as const, data: null });
},
},
};
});
import { startShelfBatch } from "../ops";
import { useVcs } from "../store";
afterEach(() => {
finished.mockReset();
useVcs.setState({ roots: [], kinds: {}, repo: null });
});
// Issue #7433: Update Project of two working copies reported "… is not a git repository of the
// project" for each when it restored the shelved changes.
describe("shelving around an update", () => {
it("is Git's: working copies of another system are neither shelved nor restored", async () => {
useVcs.setState({
roots: ["/p/boot", "/p/antd"],
kinds: { "/p/boot": "subversion", "/p/antd": "subversion" },
repo: "/p/boot",
});
const batch = startShelfBatch(["/p/boot", "/p/antd"]);
expect(batch.id).toBeNull();
expect(await batch.finish()).toBeNull();
expect(finished).not.toHaveBeenCalled();
});
it("restores only the Git repositories of a mixed project", async () => {
useVcs.setState({
roots: ["/p/app", "/p/lib", "/p/wc"],
kinds: { "/p/app": "git", "/p/lib": "git", "/p/wc": "subversion" },
repo: "/p/wc",
});
const batch = startShelfBatch(["/p/app", "/p/lib", "/p/wc"]);
expect(batch.id).not.toBeNull();
await batch.finish();
expect(finished).toHaveBeenCalledWith(batch.id, ["/p/app", "/p/lib"]);
});
});
+10 -1
Переглянути файл
@@ -282,6 +282,15 @@ function ConflictsDialog({
close();
openMergeEditor(path);
};
// A double click edits a text conflict; a working copy's tree or property conflict without
// one stays selected here, where its details and resolutions are shown.
const activate = async (path: string) => {
if (vcsKindOf(repoOf(path)) !== "git") {
const found = await call(commands.vcsConflictDetails(path)).catch((): ConflictDetail[] => []);
if (found.length && !found.some((d) => d.kind === "text")) return;
}
edit(path);
};
const pending = files.some((file) => !repo || repoOf(file.path) === repo);
const conclude = session
? { label: "Accept and Finish", disabled: !!files.length || !mergeRoot || busy, run: () => void session.finish() }
@@ -366,7 +375,7 @@ function ConflictsDialog({
}
onActivate={(row, _i, e) => {
if ("header" in row || (e.type === "click" && (e as unknown as MouseEvent).detail < 2)) return;
if (row.conflict) edit(row.path);
if (row.conflict) void activate(row.path);
else {
onClose();
void executeAction("vcs.showDiff", row.path);
+10 -3
Переглянути файл
@@ -9,7 +9,7 @@ import { editorService, type EditorInput } from "@/workbench/contributions";
import { baseName, effectiveKind } from "./model";
import { readWorkingText } from "./ops";
import { changeFileNodes, groupFileNodes, renamedFromPath, stagingSide, type ChangeNode } from "./changes";
import { currentRepoRoot, statusOf } from "./store";
import { currentRepoRoot, repoOf, statusOf, vcsKindOf } from "./store";
import { repositoryPath } from "./repositoryPaths";
import { stagingAreaOn } from "./staging";
import { stagingVersions } from "./stagingVersions";
@@ -379,8 +379,15 @@ export async function readDiffSide(path: string, side: DiffSide): Promise<string
switch (side.type) {
case "rev":
return call(commands.vcsFileAt(side.path ?? path, side.rev));
case "worktree":
return readWorkingText(path);
case "worktree": {
const text = await readWorkingText(path);
// A working copy's folder (a row for its properties) has no text on disk: its side is
// its properties, as the working copy reads them.
if (text === null && vcsKindOf(repoOf(path)) !== "git") {
return call(commands.vcsFileAt(path, "WT")).catch(() => null);
}
return text;
}
case "file":
return readWorkingText(side.path);
case "text":
+2 -1
Переглянути файл
@@ -12,6 +12,7 @@ import { repoName, useVcs } from "../store";
import { CommitMessage, RefLabels } from "./CommitMessage";
import { GraphCell } from "./GraphCell";
import { RowResizeHandle } from "./RowResizeHandle";
import { authorLabel } from "../model";
import { commitMenu } from "./commitMenu";
import { SUBJECT_COLUMN, columnSequence, type LogColumn } from "./shared";
import { REPOSITORY_WIDTH, columnPrev } from "./useColumnResize";
@@ -223,7 +224,7 @@ function CommitRowView({
column.id === "hash" && styles.hash,
)}
style={{ width }}
title={column.id === "author" ? `${c.author} <${c.email}>` : undefined}
title={column.id === "author" ? authorLabel(c.author, c.email) : undefined}
>
{column.render(c)}
<RowResizeHandle
+2 -2
Переглянути файл
@@ -25,7 +25,7 @@ import {
updateLogOptions,
useGitLog,
} from "../logStore";
import { relTo } from "../model";
import { authorLabel, relTo } from "../model";
import { branchesByRepo } from "../multiRoot";
import { LogPathsEditor, chooseLogPaths } from "../PathFilterDialog";
import { openExternalLog } from "../RevisionBrowser";
@@ -210,7 +210,7 @@ export function FilterBar({ fileHistory = false }: { fileHistory?: boolean }) {
// (loaded commits and earlier lists) and let only Select… wait for the full list.
const fetching = Promise.all(roots.map((repo) => fetchLogUsers(repo)));
const authorsOf = (users: readonly (readonly string[])[]) =>
[...new Set(users.flat().concat(commits.map((c) => `${c.author} <${c.email}>`)))].sort((a, b) =>
[...new Set(users.flat().concat(commits.map((c) => authorLabel(c.author, c.email))))].sort((a, b) =>
a.localeCompare(b),
);
const authors = authorsOf(roots.map((repo) => knownLogUsers(repo)));
+5
Переглянути файл
@@ -142,6 +142,11 @@ function relativePath(from: string, path: string): string {
return "../".repeat(source.length - common) + target.slice(common).join("/");
}
/** `Name <email>`, or the name alone for an author without one (a Subversion author). */
export function authorLabel(author: string, email: string | null | undefined): string {
return email ? `${author} <${email}>` : author;
}
/** List timestamp per Settings › System Settings › Date Formats. */
export function formatTime(ms: number | null | undefined, now = Date.now()): string {
return ms ? formatTimestamp(ms, now) : "";
+3 -1
Переглянути файл
@@ -155,7 +155,9 @@ export async function saveAll() {
await flushChangelists();
}
export function startShelfBatch(roots: readonly (string | null)[], enabled = true) {
export function startShelfBatch(targets: readonly (string | null)[], enabled = true) {
// Shelving around an update is Git's: a Subversion working copy's update keeps its changes.
const roots = targets.filter((root) => root === null || vcsKindOf(root) === "git");
const id = enabled && roots.length > 1 ? crypto.randomUUID() : null;
const project = useProject.getState().project;
let finished: Promise<string | null> | undefined;