FR: Add "manual rename" command
- Dominant language
- Rust
- Stars
- 31.6k
- Forks
- 1.2k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 65
Description
Before we get full rename detection (https://github.com/martinvonz/jj/issues/47), we could implement a "manual rename" that addresses the case where one side makes a change to a file and another renames it.
We could do this by first showing the sides in the conflict, say `left`, `right`, `base`, where `left` changes file `src/bla`, and `right` renames `src -> cli/src`. A manual rename like `jj rename --side=left src/bla cli/src/bla` would take the change from `left` and apply it on `cli/src/bla` instead of `src/bla`.
How I envision this working in terms of conflicts is that start with the following conflict expressions:
- `src/bla`: `L + R - B` (where R is the 'missing' file)
- `cli/src/bla`: `B`
Then we move the `base -> left` terms to `cli/src/bla` (maybe we'd also prompt the user to provide `base`?):
- `src/bla`: `R` (where R is the 'missing' file, so the file is deleted)
- `cli/src/bla`: `L - B + B` = `L`
Which also has a well-defined result even in the case where `base -> left` doesn't apply cleanly onto the renamed file. Perhaps that has some practical use for moving changes across files outside of a rename, but I haven't quite thought that through.
Contributor guide
Research direction
Start by reviewing the full rename-detection work in issue #47 and the conflict expressions described here. Trace how the `left`, `right`, and `base` sides are represented, then define the `jj rename --side=...` behavior for moving a change across a renamed path, including the non-clean-apply case. Done means the command and its conflict semantics are specified and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100