commands: avoid EdenApiBlocking in debugsegmentclone

Summary:
This makes it possible to drop EdenApiBlocking. Since the actual lazy clone
logic is in the Python code, we might want to only keep one of the Rust or
Python lazy clone logic eventually.

Reviewed By: yancouto

Differential Revision: D31407286

fbshipit-source-id: 3685edbf6e4709aaf8190ba65035d6627ef83fe9
This commit is contained in:
Jun Wu 2021-10-06 17:12:12 -07:00 committed by Facebook GitHub Bot
parent 7b4881a7a4
commit 05139b453b

View File

@ -10,6 +10,7 @@ use super::Result;
use super::IO;
use anyhow::Context;
use async_runtime::block_on;
use async_runtime::block_unless_interrupted;
use clidispatch::errors;
use cliparser::define_flags;
use dag::namedag::IndexedLogNameDagPath;
@ -18,7 +19,6 @@ use dag::ops::DagPersistent;
use dag::ops::Open;
use dag::CloneData;
use dag::VertexName;
use edenapi::EdenApiBlocking;
use progress_model::ProgressBar;
use progress_model::Registry;
use std::collections::HashMap;
@ -46,9 +46,12 @@ pub fn run(opts: StatusOpts, _io: &IO, config: ConfigSet) -> Result<u8> {
let edenapi_client = edenapi::Builder::from_config(&config)?.build()?;
let clone_data = edenapi_client
.clone_data_blocking(reponame.clone())
.context("error cloning segmented changelog")?;
let clone_data = match block_unless_interrupted(edenapi_client.clone_data(reponame.clone())) {
Err(e) => Err(anyhow::Error::from(e)),
Ok(Err(e)) => Err(anyhow::Error::from(e)),
Ok(Ok(v)) => Ok(v),
}
.context("error cloning segmented changelog")?;
let namedag_path = IndexedLogNameDagPath(destination.join(".hg/store/segments/v1"));
let mut namedag = namedag_path