Commit 585fd94a authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot
Browse files

Merge topic 'gitlab-10.2'

5ca52670

 types: update for 10.2
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel's avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !113
parents df795c14 5ca52670
{"target_project_id": 855, "source_branch": "add_hook-api", "downvotes": 0, "labels": [], "updated_at": "2016-10-04T16:18:57.940-04:00", "work_in_progress": false, "assignee": {"username": "brad.king", "web_url": "https://gitlab.kitware.com/brad.king", "name": "Brad King", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/0617392a2f9fd505720d0c42cefc1a10?s=80&d=identicon", "id": 10}, "user_notes_count": 3, "id": 20215, "force_remove_source_branch": true, "target_branch": "master", "subscribed": true, "title": "gitlab: expose hook addition API", "merge_commit_sha": null, "merge_when_pipeline_succeeds": false, "time_stats": {"time_estimate": 0, "human_total_time_spent": null, "human_time_estimate": null, "total_time_spent": 0}, "state": "merged", "upvotes": 0, "project_id": 855, "description": "Fixes #5.", "iid": 35, "milestone": null, "discussion_locked": null, "source_project_id": 856, "merge_status": "can_be_merged", "should_remove_source_branch": null, "created_at": "2016-10-04T15:56:43.276-04:00", "author": {"username": "ben.boeckel", "web_url": "https://gitlab.kitware.com/ben.boeckel", "name": "Ben Boeckel", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/2f5f7e99190174edb5a2f66b8653b0b2?s=80&d=identicon", "id": 13}, "sha": "04e94ae667024a62a90179f395bfdc2b35f3efd2", "web_url": "https://gitlab.kitware.com/utils/rust-gitlab/merge_requests/35"}
{"target_project_id": 855, "source_branch": "add_hook-api", "downvotes": 0, "labels": [], "updated_at": "2016-10-04T16:18:57.940-04:00", "work_in_progress": false, "assignee": {"username": "brad.king", "web_url": "https://gitlab.kitware.com/brad.king", "name": "Brad King", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/0617392a2f9fd505720d0c42cefc1a10?s=80&d=identicon", "id": 10}, "user_notes_count": 3, "id": 20215, "force_remove_source_branch": true, "target_branch": "master", "subscribed": true, "title": "gitlab: expose hook addition API", "merge_commit_sha": null, "merge_when_pipeline_succeeds": false, "time_stats": {"time_estimate": 0, "human_total_time_spent": null, "human_time_estimate": null, "total_time_spent": 0}, "state": "merged", "upvotes": 0, "project_id": 855, "description": "Fixes #5.", "iid": 35, "milestone": null, "discussion_locked": null, "source_project_id": 856, "merge_status": "can_be_merged", "changes_count": "3", "should_remove_source_branch": null, "created_at": "2016-10-04T15:56:43.276-04:00", "author": {"username": "ben.boeckel", "web_url": "https://gitlab.kitware.com/ben.boeckel", "name": "Ben Boeckel", "state": "active", "avatar_url": "https://secure.gravatar.com/avatar/2f5f7e99190174edb5a2f66b8653b0b2?s=80&d=identicon", "id": 13}, "sha": "04e94ae667024a62a90179f395bfdc2b35f3efd2", "web_url": "https://gitlab.kitware.com/utils/rust-gitlab/merge_requests/35"}
......@@ -291,6 +291,7 @@ fn test_read_merge_request() {
assert_eq!(merge_request.time_stats.total_time_spent, 0);
assert_eq!(merge_request.time_stats.human_time_estimate, None);
assert_eq!(merge_request.time_stats.human_total_time_spent, None);
assert_eq!(merge_request.changes_count, 3);
assert_eq!(merge_request.user_notes_count, 3);
assert_eq!(merge_request.discussion_locked, None);
assert_eq!(merge_request.should_remove_source_branch, None);
......
......@@ -29,6 +29,21 @@ use std::fmt::{self, Display, Formatter};
// pub name: String,
//}
fn serialize_u64_string<S>(x: &u64, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,
{
x.to_string().serialize(serializer)
}
fn deserialize_u64_string<'de, D>(deserializer: D) -> Result<u64, D::Error>
where D: Deserializer<'de>,
{
let val = <String as Deserialize>::deserialize(deserializer)?;
val.parse().map_err(|err| {
D::Error::custom(format!("string does not parse as unsigned integer: {:?}", err))
})
}
#[cfg_attr(feature="strict", serde(deny_unknown_fields))]
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
/// Type-safe user ID.
......@@ -1382,6 +1397,10 @@ pub struct MergeRequest {
pub subscribed: Option<bool>,
/// Time estimates.
pub time_stats: IssuableTimeStats,
/// The number of paths changed by the merge request.
#[serde(serialize_with = "serialize_u64_string")]
#[serde(deserialize_with = "deserialize_u64_string")]
pub changes_count: u64,
/// The number of comments on the merge request.
pub user_notes_count: u64,
/// Whether the discussion has been locked.
......@@ -1453,6 +1472,10 @@ pub struct MergeRequestChanges {
pub subscribed: Option<bool>,
/// Time estimates.
pub time_stats: IssuableTimeStats,
/// The number of paths changed by the merge request.
#[serde(serialize_with = "serialize_u64_string")]
#[serde(deserialize_with = "deserialize_u64_string")]
pub changes_count: u64,
/// The number of comments on the merge request.
pub user_notes_count: u64,
/// Whether the discussion has been locked.
......@@ -1495,6 +1518,7 @@ impl From<MergeRequestChanges> for MergeRequest {
merge_commit_sha: mr.merge_commit_sha,
subscribed: mr.subscribed,
time_stats: mr.time_stats,
changes_count: mr.changes_count,
user_notes_count: mr.user_notes_count,
discussion_locked: mr.discussion_locked,
should_remove_source_branch: mr.should_remove_source_branch,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment