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,
)
| 486 | /// placeholder identities emitted so far. Real (non-placeholder) ids — |
| 487 | /// e.g. delete ops bound to existing branches — are left untouched. |
| 488 | pub fn renumber_placeholder_ids( |
| 489 | &mut self, |
| 490 | trunk_file_idx: u32, |
| 491 | branch_base: u32, |
| 492 | leaf_base: u32, |
| 493 | ) { |
| 494 | if self.trunk_id.change_id().is_root() |
| 495 | && !matches!(self.trunk_op, Some(TrunkOp::ProjectedSpanEdit { .. })) |
| 496 | { |
| 497 | self.trunk_id = TrunkId::new(self.trunk_id.change_id(), trunk_file_idx); |
| 498 | } |
| 499 | if let Some(trunk_op) = &mut self.trunk_op { |
| 500 | let trunk = match trunk_op { |
| 501 | TrunkOp::Delete { trunk } | TrunkOp::Undelete { trunk } => Some(trunk), |
| 502 | TrunkOp::Move { trunk, .. } => Some(trunk), |
| 503 | TrunkOp::SetMode { trunk, .. } => Some(trunk), |
| 504 | TrunkOp::SetKind { trunk, .. } => Some(trunk), |
| 505 | TrunkOp::Create { .. } | TrunkOp::ProjectedSpanEdit { .. } => None, |
| 506 | }; |
| 507 | if let Some(trunk) = trunk { |
| 508 | if trunk.change_id().is_root() { |
| 509 | *trunk = TrunkId::new(trunk.change_id(), trunk_file_idx); |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | for line_op in &mut self.line_ops { |
| 514 | line_op.renumber_placeholder_ids(branch_base, leaf_base); |
| 515 | } |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | /// Shifts a ROOT-placeholder leaf identity. |
no test coverage detected