segmented_changelog: add dependency to scm/lib/dag

Summary:
It's going to be useful to share certain structures between client and server.
Looking ahead, the plan is to share the segment graph along with all the
algorithms implemented for it.

Reviewed By: StanislavGlebik

Differential Revision: D20550951

fbshipit-source-id: f498a6b0cba1bcdd35fc9720125b223d7e891a44
This commit is contained in:
Stefan Filip 2020-03-24 13:54:12 -07:00 committed by Facebook GitHub Bot
parent c400809eba
commit 031c6b2fb4

View File

@ -17,14 +17,12 @@ use anyhow::Result;
use futures::compat::Future01CompatExt;
use maplit::{hashmap, hashset};
use dag::Id as SegmentedChangelogId;
use blobrepo::BlobRepo;
use context::CoreContext;
use mononoke_types::ChangesetId;
/// An identifier in Segmented Changelog
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
pub struct SegmentedChangelogId(u64);
/// Assign an id for a head in a DAG. This implies ancestors of the
/// head will also have ids assigned.
pub async fn build_idmap(
@ -54,7 +52,7 @@ pub async fn build_idmap(
let mut todo_stack = vec![Todo::Visit(head)];
let mut seen = hashset![head];
let mut idmap = hashmap![];
let mut next_segmented_changelog_id = 1;
let mut next_segmented_changelog_id = dag::Group::MASTER.min_id().0;
while let Some(todo) = todo_stack.pop() {
match todo {