Switch and checkout name the files they take off disk 9b723f69b032
oxy bookmark switch and oxy checkout said only how many files they
removed, easy to miss when a switch to a bookmark lacking 80 files took
an editor's project file with them. They now name the first few removed
files, and warn when twenty or more go.
closes #102
- **A switch names what it takes off disk (#102).** `oxy bookmark switch` and `oxy checkout` printed only how many files they removed, easy to miss when a switch to a bookmark lacking 80 files took an editor's project file with them. They now name the first few removed files, with a warning when twenty or more go.
6
+
5
7
- **Large new files are not snapshotted unseen, and past snapshots expire (#98).** A 1 GB image left untracked in a working tree was taken in by the next `status` and kept by the operation log for good: deleting the file and running `gc --now` freed nothing. Now a new, untracked file over `snapshot.max-new-file-size` (default 100 MiB) is left out and named by `status`, with how to ignore it or raise the limit; tracked files and files already in the working copy are unaffected. Past working-copy snapshots keep their files only for `core.snapshot-retention` (default 7 days), so `gc` prunes what only they held, and `oxy gc --expire-snapshots --now` does it at once. `undo` and `op restore` to an operation whose working copy has expired keep the files as they are.
6
8
7
9
- **`oxy undo` undoes this workspace's last command (#99).** It undid the repository's newest operation, whichever workspace made it: in a repository with several workspaces an undo could take back another workspace's commit or merge, and it said only which operation it went back to. Operations now record their workspace, and undo takes back this workspace's last command, leaving other workspaces' work as it is. On a bookmark both share, only its own heads go; a change another workspace built on it, or the workspace it would take away, refuses the undo and names it. Undo now says which command it undid and what that changed, passes over pushes (the remote keeps what it was sent), and warns when an undone commit is already on a remote. `oxy amend` warns when it rewrites a change a remote already has, so the next push will need `--force`.
…
172 unchanged lines
modifiedcrates/oxy-core/src/repo/checkout.rs+5−0
…
5 unchanged lines
6
6
pub struct CheckoutReport {
7
7
pub written: usize,
8
8
pub removed: usize,
9
+
/// The first files removed, to name them (oxygen#102).
10
+
pub removed_paths: Vec<String>,
9
11
pub conflicted: bool,
10
12
/// Nested repositories that could not be moved, and other remarks.
11
13
pub notes: Vec<String>,
…
84 unchanged lines
96
98
}
97
99
fs::remove_file(&full)?;
98
100
report.removed += 1;
101
+
if report.removed_paths.len() < 5 {
102
+
report.removed_paths.push(path.to_string());
103
+
}
99
104
if let Some(parent) = full.parent() {
100
105
dirs_to_prune.insert(parent.to_path_buf());
101
106
}
…
535 unchanged lines
modifiedcrates/oxy-core/src/repo/tests.rs+1−0
…
431 unchanged lines
432
432
CheckoutReport {
433
433
written: 2,
434
434
removed: 1,
435
+
removed_paths: vec!["bin.dat".into()],
435
436
conflicted: false,
436
437
notes: vec![],
437
438
lacks: 1,
…
8084 unchanged lines
modifiedsrc/cli/workspace.rs+30−0
…
98 unchanged lines
99
99
);
100
100
}
101
101
102
+
/// Name what a checkout removed from the working copy (oxygen#102): a
103
+
/// switch to a bookmark lacking files takes them off disk, which an
104
+
/// editor open on the tree notices before a person reading a count does.