jj-vcs / jj-vcs/jj

FR: Add "manual rename" command

Open
#2,012 1 comment 2 reactions 0 assignees View on GitHub
enhancement🏗️
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.