Shifts this entry's ROOT-placeholder identity into a per-change unique namespace (CB-9B review F4). The recorder builds each file's semantic ops independently, so every entry starts its placeholder counters at zero (`TrunkId(ROOT, 0)`, `BranchId(ROOT, 0..)`, `LeafId(ROOT, 0..)`). The apply pass substitutes `TrunkId(ROOT, f)` → `TrunkId(change_id, f)` and `BranchId(ROOT, b)` → `BranchId(change_id,
(
&mut self,
trunk_file_idx: u32,
branch_base: u32,
leaf_base: u32,
)
| 501 | /// placeholder identities emitted so far. Real (non-placeholder) ids — |
| 502 | /// e.g. delete ops bound to existing branches — are left untouched. |
| 503 | pub fn renumber_placeholder_ids( |
| 504 | &mut self, |
| 505 | trunk_file_idx: u32, |
| 506 | branch_base: u32, |
| 507 | leaf_base: u32, |
| 508 | ) { |
| 509 | if self.trunk_id.change_id().is_root() |
| 510 | && !matches!(self.trunk_op, Some(TrunkOp::ProjectedSpanEdit { .. })) |
| 511 | { |
| 512 | self.trunk_id = TrunkId::new(self.trunk_id.change_id(), trunk_file_idx); |
| 513 | } |
| 514 | if let Some(trunk_op) = &mut self.trunk_op { |
| 515 | let trunk = match trunk_op { |
| 516 | TrunkOp::Delete { trunk } | TrunkOp::Undelete { trunk } => Some(trunk), |
| 517 | TrunkOp::Move { trunk, .. } => Some(trunk), |
| 518 | TrunkOp::SetMode { trunk, .. } => Some(trunk), |
| 519 | TrunkOp::SetKind { trunk, .. } => Some(trunk), |
| 520 | TrunkOp::Create { .. } | TrunkOp::ProjectedSpanEdit { .. } => None, |
| 521 | }; |
| 522 | if let Some(trunk) = trunk { |
| 523 | if trunk.change_id().is_root() { |
| 524 | *trunk = TrunkId::new(trunk.change_id(), trunk_file_idx); |
| 525 | } |
| 526 | } |
| 527 | } |
| 528 | for line_op in &mut self.line_ops { |
| 529 | line_op.renumber_placeholder_ids(branch_base, leaf_base); |
| 530 | } |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | /// Shifts a ROOT-placeholder leaf identity. |
no test coverage detected