mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
dag: forbid pull fast path with pending changes
Summary: Pull fast path uses `reload` which drops pending changes. To avoid misuse, raise an error if pending changes are present. Reviewed By: andll Differential Revision: D29363799 fbshipit-source-id: 8f520d2c5553432abc452bc7b2b59d7af80e0a99
This commit is contained in:
parent
29d07f8f73
commit
ac63c8df22
@ -447,6 +447,13 @@ where
|
||||
S: TryClone + Persist + Send + Sync + 'static,
|
||||
{
|
||||
async fn import_pull_data(&mut self, clone_data: CloneData<VertexName>) -> Result<()> {
|
||||
if !self.pending_heads.is_empty() {
|
||||
return programming(format!(
|
||||
"import_pull_data called with pending heads ({:?})",
|
||||
&self.pending_heads,
|
||||
));
|
||||
}
|
||||
|
||||
let (lock, map_lock, dag_lock) = self.reload()?;
|
||||
|
||||
// Parents that should exist in the local graph. Look them up in 1 round-trip
|
||||
|
@ -319,3 +319,16 @@ async fn test_pull_lazy_with_merges() {
|
||||
);
|
||||
assert_eq!(client.output(), ["resolve names: [C, D, F, L], heads: [E]"]);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_pull_no_pending_changes() {
|
||||
let mut server = TestDag::draw("A # master: A");
|
||||
let mut client = server.client_cloned_data().await;
|
||||
server.drawdag("A-B-C", &["C"]);
|
||||
client.drawdag("A-D", &[]);
|
||||
let e = client.pull_ff_master(&server, "A", "C").await.unwrap_err();
|
||||
assert_eq!(
|
||||
e.to_string(),
|
||||
"ProgrammingError: import_pull_data called with pending heads ([D])"
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user