mirror of
https://github.com/jj-vcs/jj.git
synced 2026-07-03 14:02:54 +08:00
When multiple bookmarked revisions exist in a stack, previously merged revisions were not abandoned because they remained reachable. This patch fixes that by rewriting merged revisions based on their change IDs and rebasing their descendants onto the merged head. The tricky part is that we shouldn't "rewrite" locally hidden revisions that were remotely reachable (but no longer are). However, we still need to count them as predecessors for a better evolution history. There is a known issue where immutable descendants can accidentally be rebased onto rewritten immutable parents. For example, suppose we have the history A@origin <- B@origin and A@origin is rewritten remotely. If we fetch only A'@origin, B@origin ends up being rebased onto A'@origin. Because remote bookmarks do not move locally, this process creates a new, anonymous B revision. One way to fix this would be to implement rebase_descendants() that leaves immutable descendants untouched, while still allowing mutable descendants to be rebased onto A'@origin.