mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
metaconfig: learn about version_name for CommitSyncConfig
Summary: This diff adds support for the `version_name` field, coming from the `commitsyncmap` config, stored in the configerator. Note: ATM, this field is optional in the thrift config, but once we get past the initial deployment stage, I expect it to be present always. This is why in `CommmitSyncConfig` I make it `String` (with a default value of `""`) rather than `Option<String>`. The code, which will be writing this value into `synced_commit_mapping` should not ever care whether it's present or not, since every mapping should always have a `version_name` present. Reviewed By: StanislavGlebik Differential Revision: D21764641 fbshipit-source-id: 35a7f487acf0562b309fd6d1b6473e3b8024722d
This commit is contained in:
parent
9090d7bdf1
commit
78bf80c13a
@ -530,6 +530,7 @@ mod test {
|
||||
small_repos: hashmap! {
|
||||
small_repo.get_repoid() => small_repo_sync_config,
|
||||
},
|
||||
version_name: "TEST_VERSION_NAME".to_string(),
|
||||
};
|
||||
update_large_repo_bookmarks(
|
||||
ctx.clone(),
|
||||
|
@ -153,6 +153,7 @@ mod test {
|
||||
RepositoryId::new(1) => get_small_repo_sync_config_1(),
|
||||
RepositoryId::new(2) => get_small_repo_sync_config_2(),
|
||||
},
|
||||
version_name: "TEST_VERSION_NAME".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,6 +262,7 @@ pub async fn init_small_large_repo(
|
||||
small_repos: hashmap! {
|
||||
smallrepo.get_repoid() => small_repo_sync_config,
|
||||
},
|
||||
version_name: "TEST_VERSION_NAME".to_string(),
|
||||
};
|
||||
|
||||
Ok((
|
||||
|
@ -495,6 +495,7 @@ mod test {
|
||||
RepositoryId::new(1) => get_small_repo_sync_config_1_non_ovelapping(),
|
||||
RepositoryId::new(2) => get_small_repo_sync_config_2_non_ovelapping(),
|
||||
},
|
||||
version_name: "TEST_VERSION_NAME".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,6 +654,7 @@ mod test {
|
||||
direction: CommitSyncDirection::LargeToSmall,
|
||||
},
|
||||
},
|
||||
version_name: "TEST_VERSION_NAME".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// @generated SignedSource<<6b02e6469f636f9c9e06f7b9386b8216>>
|
||||
// @generated SignedSource<<484dfab89a7148f0bd4a1aa26d47862d>>
|
||||
// DO NOT EDIT THIS FILE MANUALLY!
|
||||
// This file is a mechanical copy of the version in the configerator repo. To
|
||||
// modify it, edit the copy in the configerator repo instead and copy it over by
|
||||
@ -340,6 +340,7 @@ struct RawCommitSyncConfig {
|
||||
1: i32 large_repo_id,
|
||||
2: list<string> common_pushrebase_bookmarks,
|
||||
3: list<RawCommitSyncSmallRepoConfig> small_repos,
|
||||
4: optional string version_name,
|
||||
}
|
||||
|
||||
struct RawWireprotoLoggingConfig {
|
||||
|
@ -287,8 +287,10 @@ impl RepoConfigs {
|
||||
let RawCommitSyncConfig {
|
||||
large_repo_id,
|
||||
common_pushrebase_bookmarks,
|
||||
small_repos
|
||||
small_repos,
|
||||
version_name,
|
||||
} = v;
|
||||
|
||||
let small_repos: Result<HashMap<RepositoryId, SmallRepoCommitSyncConfig>> = small_repos
|
||||
.into_iter()
|
||||
.map(|raw_small_repo_config| {
|
||||
@ -346,6 +348,7 @@ impl RepoConfigs {
|
||||
large_repo_id,
|
||||
common_pushrebase_bookmarks: common_pushrebase_bookmarks?,
|
||||
small_repos: small_repos?,
|
||||
version_name: version_name.unwrap_or_else(|| "".to_string()),
|
||||
};
|
||||
|
||||
Self::verify_commit_sync_config(&commit_sync_config)
|
||||
@ -991,6 +994,7 @@ mod test {
|
||||
[mega]
|
||||
large_repo_id = 1
|
||||
common_pushrebase_bookmarks = ["master"]
|
||||
version_name = "TEST_VERSION_NAME"
|
||||
|
||||
[[mega.small_repos]]
|
||||
repoid = 2
|
||||
@ -1047,6 +1051,7 @@ mod test {
|
||||
direction: CommitSyncDirection::SmallToLarge,
|
||||
}
|
||||
},
|
||||
version_name: "TEST_VERSION_NAME".to_string(),
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1156,6 +1156,8 @@ pub struct CommitSyncConfig {
|
||||
pub common_pushrebase_bookmarks: Vec<BookmarkName>,
|
||||
/// Corresponding small repo configs
|
||||
pub small_repos: HashMap<RepositoryId, SmallRepoCommitSyncConfig>,
|
||||
/// Version name of the commit sync config
|
||||
pub version_name: String,
|
||||
}
|
||||
|
||||
/// Configuration for logging wireproto commands and arguments
|
||||
|
Loading…
Reference in New Issue
Block a user