Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually sync from internal repo #44

Merged
merged 68 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
1941cd0
remotefilelog: do not resolve linkrev for changelog.add
quark-zju Aug 19, 2020
0ff7fc4
commits: add double write commits backend
quark-zju Aug 19, 2020
44056e3
commits: add a trait to describe storage backend and use-cases
quark-zju Aug 19, 2020
fa9f8ef
renderdag: move to dag
quark-zju Aug 19, 2020
c14a1d7
dag: add import_and_flush API
quark-zju Aug 19, 2020
ce91c9d
pydag: update bindings
quark-zju Aug 19, 2020
490ed99
SAI API 1.6.3
shri-khare Aug 20, 2020
53ea2be
Remove all remaining calls to completeInThread
Aug 20, 2020
ce20dc7
mononoke: try to print warning about expensive getbundle earlier
StanislavGlebik Aug 20, 2020
41cf292
mononoke_api: resolve_bookmark should still check the db on cache miss
markbt Aug 20, 2020
15b750e
bgprogress: Stdio is only used on Unix
markbt Aug 20, 2020
4739bdb
commitcloud: only send most recent obsmarkers
markbt Aug 20, 2020
ca498c6
commitcloud: don't send obsmarkers if evolution is not enabled
markbt Aug 20, 2020
fd38fba
commitcloud: complete the transaction to sync from the cloud
markbt Aug 20, 2020
faa88db
mononoke_api: add tests for resolve_bookmark and list_bookmarks
markbt Aug 20, 2020
048520e
mononoke_api: remove a use of old futures
markbt Aug 20, 2020
5e28ee0
configs: handle timestamp anomalies in dynamicconfigs
DurhamG Aug 20, 2020
5cea9f8
mononoke/repo_import: removed callsign command argument for repo_import
Aug 20, 2020
71eb608
mercurial: tidy up eden import helper mononoke detection
wez Aug 20, 2020
093ac35
Updating submodules
Aug 20, 2020
3d6715e
add an option to serve commit cloud smartlog from the original
Aug 20, 2020
81afe81
Updating submodules
Aug 20, 2020
83459bf
doctor: repair hgcommits directory too
quark-zju Aug 20, 2020
59b6a5d
commands: add debugchangelog command
quark-zju Aug 21, 2020
197cb53
pydag: add an API to migrate from one DAG to segmented DAG
quark-zju Aug 21, 2020
329be4a
changelog2: add ways to migrate between formats
quark-zju Aug 21, 2020
bab1b11
changelog: expose algorithmbackend API
quark-zju Aug 21, 2020
d4f46ea
changelog: tonodes(idset) has a fast path
quark-zju Aug 21, 2020
452b5f9
changelog: do not use nullid as "master node"
quark-zju Aug 21, 2020
70179af
smartset: add Rust nameset wrapper
quark-zju Aug 21, 2020
a1aa47a
changelog2: preserve laziness of 'ancestors'
quark-zju Aug 21, 2020
0718e0b
dag: drop inverse DAG
quark-zju Aug 21, 2020
320e04e
dag: add NameDag::snapshot_dag
quark-zju Aug 21, 2020
38b9ef8
dag: add DagAlgorithm::snapshot_dag
quark-zju Aug 21, 2020
865013e
dag: fix re-assigning master flush
quark-zju Aug 21, 2020
cf9e639
nameset: new metaset for separate iter+contains lazy/fast paths
quark-zju Aug 21, 2020
a050d97
nameset: do not swap x & y if they come from different graphs
quark-zju Aug 21, 2020
7c98850
nameset: use real dag snapshot instead of a pointer in hints
quark-zju Aug 21, 2020
079e879
nameset: use real id map snapshot instead of a pointer in hints
quark-zju Aug 21, 2020
acaeda8
nameset: a & b should not use id-based fast path if id map is incompa…
quark-zju Aug 21, 2020
ffe13c5
nameset: add flatten API
quark-zju Aug 21, 2020
1316e7f
dag: make to_set API bind the dag
quark-zju Aug 21, 2020
d4851b9
dag: make IdMap::assign_head calculate flat segments
quark-zju Aug 21, 2020
5b4dcb2
dag: improve segment building perf by using precalculated flat segments
quark-zju Aug 21, 2020
8eb0bd8
dag: add some tracing spans
quark-zju Aug 21, 2020
9bc8aab
dag: test high-level segments building for non-master
quark-zju Aug 21, 2020
0d66952
dag: fix non-master high-level segments building
quark-zju Aug 21, 2020
00dd327
mutationstore: optimize get_dag
quark-zju Aug 21, 2020
c587f36
mutationstore: add a native path to calculate 'obsolete()'
quark-zju Aug 21, 2020
0928200
pymutationstore: make getdag support selecting successors or predeces…
quark-zju Aug 21, 2020
9d1183a
commitcloud: optimize revset for segmented changelog backend
quark-zju Aug 21, 2020
5fbb8e8
test-smartlog: use explicit template
quark-zju Aug 21, 2020
47048cc
test-smartlog: avoid using rev numbers
quark-zju Aug 21, 2020
7a78f7b
smartlog: migrate some revset calculation to a faster path
quark-zju Aug 21, 2020
180ad7e
configs: fix osx test runs
DurhamG Aug 21, 2020
f01f617
Updating submodules
Aug 21, 2020
2767501
revset: optimize revset functions using rust fast paths
quark-zju Aug 21, 2020
575fb57
gitdag: crate to build segmented dag from git history
quark-zju Aug 21, 2020
92ede8b
hgcommits: use concrete error types
quark-zju Aug 21, 2020
0aeb52a
hgcommits: add gitsegments backend
quark-zju Aug 21, 2020
c82c7dc
changelog2: initial support for segmented git changelog
quark-zju Aug 21, 2020
949598d
changelog2: add SHA1 verification
quark-zju Aug 21, 2020
d25a767
dag: fix fuzz tests
quark-zju Aug 21, 2020
242743b
Updating submodules
Aug 21, 2020
16ba1fc
add undelete workspace command
Aug 21, 2020
5709cca
Updating submodules
Aug 21, 2020
65659eb
test-git-changelog: fix the test on Windows
quark-zju Aug 21, 2020
6e3b0d3
hgcommands: show milliseconds on RUST_LOG output
quark-zju Aug 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/deps/github_hashes/facebook/fbthrift-rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Subproject commit 2f42bd0f67f5026eb0d39e0b6373ca5f94e1f28b
Subproject commit cb9cdc2428aeb1d767f97fd5addff7268e4db1e0
2 changes: 1 addition & 1 deletion build/deps/github_hashes/facebook/folly-rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Subproject commit 16a708482bbb4e1b87fa0f1ba75b2697c1a6e38d
Subproject commit 91a2c0c0d11d94a606d9a6af5e1fe084dd9c4fc4
2 changes: 1 addition & 1 deletion build/deps/github_hashes/facebook/wangle-rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Subproject commit 1a5201135de481639570eb7fa561d6d2948989b0
Subproject commit 182b824ec414b41f87041c690e7a82b4991488d2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Subproject commit cbf9d75393c95bb689ee19f3eb734232d9008495
Subproject commit 76ceb4b8873d3e492c2aa34efda9a5069bc2f12e
2 changes: 1 addition & 1 deletion build/deps/github_hashes/facebookincubator/fizz-rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Subproject commit 74db41416859c316156fb7897b1a97d79a87cb29
Subproject commit 344311bc7bee6e4ea4ebd7c2ad119245c081fcf0
2 changes: 1 addition & 1 deletion build/deps/github_hashes/rsocket/rsocket-cpp-rev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Subproject commit ab1d231926bdc8f28ddb18e3d163db73a42041a4
Subproject commit 6505c0d8607e2ad6a32008d7a545ad24123d31dd
6 changes: 3 additions & 3 deletions build/fbcode_builder/manifests/libsai
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name = libsai

[download]
url = https://github.com/opencomputeproject/SAI/archive/v1.5.2.tar.gz
sha256 = c93bcab3555c9b537752e218c754a951e95b37a438a34112dd0c86e9f6bbd34a
url = https://github.com/opencomputeproject/SAI/archive/v1.6.3.tar.gz
sha256 = ff09308fea187885b8f4d86446c5e0c097e801e8fe98de1b5e25cdc80d52e3cb

[build]
builder = nop
subdir = SAI-1.5.2
subdir = SAI-1.6.3

[install.files]
inc = include
11 changes: 4 additions & 7 deletions eden/fs/service/EdenServiceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,10 +1057,8 @@ void EdenServiceHandler::async_tm_getScmStatusV2(
}));
})
.thenTry([cb = std::move(callback)](
folly::Try<std::unique_ptr<GetScmStatusResult>>&&
result) mutable {
apache::thrift::HandlerCallback<std::unique_ptr<GetScmStatusResult>>::
completeInThread(std::move(cb), std::move(result));
folly::Try<std::unique_ptr<GetScmStatusResult>>&& result) {
cb->complete(std::move(result));
});
}

Expand Down Expand Up @@ -1091,9 +1089,8 @@ void EdenServiceHandler::async_tm_getScmStatus(
hash, listIgnored, /*enforceCurrentParent=*/false, request));
})
.thenTry([cb = std::move(callback)](
folly::Try<std::unique_ptr<ScmStatus>>&& result) mutable {
apache::thrift::HandlerCallback<std::unique_ptr<ScmStatus>>::
completeInThread(std::move(cb), std::move(result));
folly::Try<std::unique_ptr<ScmStatus>>&& result) {
cb->complete(std::move(result));
});
}

Expand Down
6 changes: 6 additions & 0 deletions eden/mononoke/metaconfig/parser/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ fn parse_repo_config(
repo_client_use_warm_bookmarks_cache,
warm_bookmark_cache_check_blobimport,
repo_client_knobs,
phabricator_callsign,
..
} = repo_config;

Expand Down Expand Up @@ -375,6 +376,7 @@ fn parse_repo_config(
segmented_changelog_config,
warm_bookmark_cache_check_blobimport,
repo_client_knobs,
phabricator_callsign,
})
}

Expand Down Expand Up @@ -882,6 +884,7 @@ mod test {
hipster_acl="foo/test"
repo_client_use_warm_bookmarks_cache=true
warm_bookmark_cache_check_blobimport=true
phabricator_callsign="FBS"

[wireproto_logging]
scribe_category="category"
Expand Down Expand Up @@ -977,6 +980,7 @@ mod test {
storage_config="files"
hgsql_name = "www-foobar"
hgsql_globalrevs_name = "www-barfoo"
phabricator_callsign="WWW"

[storage.files.metadata.local]
local_db_path = "/tmp/www"
Expand Down Expand Up @@ -1188,6 +1192,7 @@ mod test {
repo_client_knobs: RepoClientKnobs {
allow_short_getpack_history: true,
},
phabricator_callsign: Some("FBS".to_string()),
},
);

Expand Down Expand Up @@ -1240,6 +1245,7 @@ mod test {
segmented_changelog_config: SegmentedChangelogConfig { enabled: false },
warm_bookmark_cache_check_blobimport: false,
repo_client_knobs: RepoClientKnobs::default(),
phabricator_callsign: Some("WWW".to_string()),
},
);
assert_eq!(
Expand Down
2 changes: 2 additions & 0 deletions eden/mononoke/metaconfig/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ pub struct RepoConfig {
pub warm_bookmark_cache_check_blobimport: bool,
/// Configuration for repo_client module
pub repo_client_knobs: RepoClientKnobs,
/// Callsign to check phabricator commits
pub phabricator_callsign: Option<String>,
}

/// Configuration for repo_client module
Expand Down
1 change: 1 addition & 0 deletions eden/mononoke/mononoke_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ futures = { version = "0.3.5", features = ["async-await", "compat"] }
futures-old = { package = "futures", version = "0.1" }
itertools = "0.8"
maplit = "1.0"
regex = "1.3.7"
slog = { version = "2.5", features = ["max_level_debug"] }
thiserror = "1.0"

Expand Down
3 changes: 1 addition & 2 deletions eden/mononoke/mononoke_api/src/changeset_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use futures::compat::Future01CompatExt;
use futures::future::{try_join_all, FutureExt, Shared, TryFutureExt};
use futures::stream::{Stream, TryStreamExt};
use futures::try_join;
use futures_old::Future as FutureLegacy;
use manifest::{Entry, ManifestOps};
use mononoke_types::{
Blame, ChangesetId, ContentId, FileType, FileUnodeId, FsnodeId, Generation, ManifestUnodeId,
Expand Down Expand Up @@ -267,14 +266,14 @@ impl ChangesetPathContext {
})?;

fetch_blame(ctx, repo, csid, mpath.clone())
.compat()
.map_err(|error| match error {
BlameError::NoSuchPath(_)
| BlameError::IsDirectory(_)
| BlameError::Rejected(_) => MononokeError::InvalidRequest(error.to_string()),
BlameError::DeriveError(e) => MononokeError::from(e),
_ => MononokeError::from(Error::from(error)),
})
.compat()
.await
}

Expand Down
39 changes: 25 additions & 14 deletions eden/mononoke/mononoke_api/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@ use fbinit::FacebookInit;
use filestore::{Alias, FetchKey};
use futures::compat::{Future01CompatExt, Stream01CompatExt};
use futures::future::try_join_all;
use futures::stream::{StreamExt, TryStreamExt};
use futures::stream::{Stream, StreamExt, TryStreamExt};
use futures::try_join;
use futures_old::stream::Stream;
use itertools::Itertools;
#[cfg(test)]
use live_commit_sync_config::TestLiveCommitSyncConfig;
use live_commit_sync_config::{CfgrLiveCommitSyncConfig, LiveCommitSyncConfig};
use mercurial_types::Globalrev;
#[cfg(test)]
use metaconfig_types::SourceControlServiceParams;
use metaconfig_types::{CommonConfig, RepoConfig};
#[cfg(test)]
use metaconfig_types::{InfinitepushNamespace, InfinitepushParams, SourceControlServiceParams};
use mononoke_types::{
hash::{GitSha1, Sha1, Sha256},
Generation, RepositoryId,
};
use mutable_counters::SqlMutableCounters;
use permission_checker::{ArcPermissionChecker, MononokeIdentitySet, PermissionCheckerBuilder};
#[cfg(test)]
use regex::Regex;
use revset::AncestorsNodeStream;
use scuba_ext::ScubaSampleBuilderExt;
use segmented_changelog::SegmentedChangelog;
Expand Down Expand Up @@ -283,6 +284,12 @@ impl Repo {

let config = RepoConfig {
commit_sync_config: init_commit_sync_config,
infinitepush: InfinitepushParams {
namespace: Some(InfinitepushNamespace::new(
Regex::new("scratch/.+").unwrap(),
)),
..Default::default()
},
source_control_service: SourceControlServiceParams {
permit_writes: true,
..Default::default()
Expand Down Expand Up @@ -701,16 +708,21 @@ impl RepoContext {
) -> Result<Option<ChangesetContext>, MononokeError> {
let bookmark = BookmarkName::new(bookmark.as_ref())?;

let cs_id = match freshness {
let mut cs_id = match freshness {
BookmarkFreshness::MaybeStale => self.warm_bookmarks_cache().get(&bookmark),
BookmarkFreshness::MostRecent => {
self.blob_repo()
.get_bonsai_bookmark(self.ctx.clone(), &bookmark)
.compat()
.await?
}
BookmarkFreshness::MostRecent => None,
};

// If the bookmark wasn't found in the warm bookmarks cache, it might
// be a scratch bookmark, so always do the look-up.
if cs_id.is_none() {
cs_id = self
.blob_repo()
.get_bonsai_bookmark(self.ctx.clone(), &bookmark)
.compat()
.await?
}

Ok(cs_id.map(|cs_id| ChangesetContext::new(self.clone(), cs_id)))
}

Expand Down Expand Up @@ -836,7 +848,7 @@ impl RepoContext {
prefix: Option<&str>,
after: Option<&str>,
limit: Option<u64>,
) -> Result<impl Stream<Item = (String, ChangesetId), Error = MononokeError>, MononokeError>
) -> Result<impl Stream<Item = Result<(String, ChangesetId), MononokeError>>, MononokeError>
{
let kinds = if include_scratch {
if prefix.is_none() {
Expand Down Expand Up @@ -891,8 +903,7 @@ impl RepoContext {
)
.map_ok(|(bookmark, cs_id)| (bookmark.into_name().into_string(), cs_id))
.map_err(MononokeError::from)
.boxed()
.compat();
.boxed();
Ok(bookmarks)
}

Expand Down
1 change: 1 addition & 0 deletions eden/mononoke/mononoke_api/src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

mod test_history;
mod test_repo;
mod test_repo_bookmarks;
mod test_repo_create_changeset;
mod test_repo_move_bookmark;
133 changes: 133 additions & 0 deletions eden/mononoke/mononoke_api/src/test/test_repo_bookmarks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/

use std::collections::BTreeMap;
use std::sync::Arc;

use anyhow::Result;
use bookmarks::{BookmarkName, BookmarkUpdateReason};
use context::CoreContext;
use fbinit::FacebookInit;
use futures::stream::TryStreamExt;
use mononoke_types::ChangesetId;
use tests_utils::drawdag::create_from_dag;

use crate::repo::{BookmarkFreshness, Repo, RepoContext};

async fn init_repo(ctx: &CoreContext) -> Result<(RepoContext, BTreeMap<String, ChangesetId>)> {
let blob_repo = blobrepo_factory::new_memblob_empty(None)?;
let changesets = create_from_dag(
ctx,
&blob_repo,
r##"
A-B-C-D-E
\
F-G
"##,
)
.await?;
let mut txn = blob_repo.update_bookmark_transaction(ctx.clone());
txn.force_set(
&BookmarkName::new("trunk")?,
changesets["E"],
BookmarkUpdateReason::TestMove,
None,
)?;
txn.create_scratch(&BookmarkName::new("scratch/branch")?, changesets["G"])?;
txn.create_scratch(&BookmarkName::new("scratch/branchpoint")?, changesets["B"])?;
txn.commit().await?;

let repo = Repo::new_test(ctx.clone(), blob_repo).await?;
let repo_ctx = RepoContext::new(ctx.clone(), Arc::new(repo)).await?;
Ok((repo_ctx, changesets))
}

#[fbinit::compat_test]
async fn resolve_bookmark(fb: FacebookInit) -> Result<()> {
let ctx = CoreContext::test_mock(fb);
let (repo, changesets) = init_repo(&ctx).await?;
let repo = repo.write().await?;

// Test that normal bookmarks are visible both in and through the cache.
assert_eq!(
repo.resolve_bookmark("trunk", BookmarkFreshness::MostRecent)
.await?
.unwrap()
.id(),
changesets["E"],
);

assert_eq!(
repo.resolve_bookmark("trunk", BookmarkFreshness::MaybeStale)
.await?
.unwrap()
.id(),
changesets["E"],
);

// Test that scratch bookmarks are visible through the cache.
assert_eq!(
repo.resolve_bookmark("scratch/branch", BookmarkFreshness::MaybeStale)
.await?
.unwrap()
.id(),
changesets["G"],
);

assert_eq!(
repo.resolve_bookmark("scratch/branchpoint", BookmarkFreshness::MaybeStale)
.await?
.unwrap()
.id(),
changesets["B"],
);

// Test that non-existent bookmarks don't exist either way.
assert!(repo
.resolve_bookmark("scratch/nonexistent", BookmarkFreshness::MaybeStale)
.await?
.is_none());

assert!(repo
.resolve_bookmark("nonexistent", BookmarkFreshness::MostRecent)
.await?
.is_none());

Ok(())
}

#[fbinit::compat_test]
async fn list_bookmarks(fb: FacebookInit) -> Result<()> {
let ctx = CoreContext::test_mock(fb);
let (repo, changesets) = init_repo(&ctx).await?;
let repo = repo.write().await?;

assert_eq!(
repo.list_bookmarks(false, None, None, None)?
.try_collect::<Vec<_>>()
.await?,
vec![(String::from("trunk"), changesets["E"])]
);

assert_eq!(
repo.list_bookmarks(true, Some("scratch/"), None, Some(3))?
.try_collect::<Vec<_>>()
.await?,
vec![
(String::from("scratch/branch"), changesets["G"]),
(String::from("scratch/branchpoint"), changesets["B"])
]
);

assert_eq!(
repo.list_bookmarks(true, Some("scratch/"), Some("scratch/branch"), Some(3))?
.try_collect::<Vec<_>>()
.await?,
vec![(String::from("scratch/branchpoint"), changesets["B"])]
);
Ok(())
}
Loading