diff --git a/eden/scm/lib/dag/src/namedag.rs b/eden/scm/lib/dag/src/namedag.rs index a59eadaa12..3fc1142ade 100644 --- a/eden/scm/lib/dag/src/namedag.rs +++ b/eden/scm/lib/dag/src/namedag.rs @@ -813,13 +813,18 @@ where } fn invalidate_overlay_map(&mut self) -> Result<()> { - let next_id = self.dag.next_free_id(0, Group::MASTER)?; self.overlay_map = Default::default(); - self.overlay_map_next_id = next_id; + self.update_overlay_map_next_id()?; tracing::debug!(target: "dag::cache", "cleared overlay map cache"); Ok(()) } + fn update_overlay_map_next_id(&mut self) -> Result<()> { + let next_id = self.dag.next_free_id(0, Group::MASTER)?; + self.overlay_map_next_id = next_id; + Ok(()) + } + /// Attempt to get a snapshot of this graph. pub(crate) fn try_snapshot(&self) -> Result> { if let Some(s) = self.snapshot.read().deref() { @@ -2035,6 +2040,10 @@ where self.dag .build_segments_volatile_from_prepared_flat_segments(&outcome)?; + // The master group might have new vertexes inserted, which will + // affect the `overlay_map_next_id`. + self.update_overlay_map_next_id()?; + // Rebuild non-master ids and segments. if self.need_rebuild_non_master() { self.rebuild_non_master().await?; diff --git a/eden/scm/tests/test-lazy-pull-overlap-master.t b/eden/scm/tests/test-lazy-pull-overlap-master.t index ea387c1352..191a54b19c 100644 --- a/eden/scm/tests/test-lazy-pull-overlap-master.t +++ b/eden/scm/tests/test-lazy-pull-overlap-master.t @@ -64,14 +64,7 @@ Create commits in the client repo. Make them overlap with the server-side master INFO dag::cache: skip flushing 112478962961147124edd43549aedd1a335e44bf-1 to IdMap set by DAG_SKIP_FLUSH_VERTEXES Pull: -(On Windows the error message is a bit different) -#if no-windows $ hg pull -B master pulling from test:e1 searching for changes - transaction abort! - rollback completed - error.RustError: ProgrammingError: Server returned x~n (x = a31451c3c1debad52cf22ef2aebfc88c75dc899a 7, n = 6). But x exceeds the head in the local master group 5. This is not expected and indicates some logic error on the server side. - [255] -#endif