Skip to content

Commit c249e59

Browse files
christian-schillingLMG
authored andcommitted
Add full commit message to graphql api
Change-Id: graphql-commit-message
1 parent 16959a9 commit c249e59

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

src/graphql.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,17 @@ impl Revision {
125125
Ok(filter_commit.summary().unwrap_or("").to_owned())
126126
}
127127

128+
fn message(&self, context: &Context) -> FieldResult<String> {
129+
let transaction = context.transaction.lock()?;
130+
let commit = transaction.repo().find_commit(self.commit_id)?;
131+
let filter_commit = transaction.repo().find_commit(filter::apply_to_commit(
132+
self.filter,
133+
&commit,
134+
&transaction,
135+
)?)?;
136+
Ok(filter_commit.message().unwrap_or("").to_owned())
137+
}
138+
128139
fn date(&self, format: String, context: &Context) -> FieldResult<String> {
129140
let transaction = context.transaction.lock()?;
130141
let commit = transaction.repo().find_commit(self.commit_id)?;

tests/filter/graphql_history.t

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
> rev(at: "HEAD", filter: ":workspace=ws") {
2323
> history(limit: 1) {
2424
> summary
25+
> message
2526
> }
2627
> }
2728
> }
@@ -32,7 +33,8 @@
3233
"rev": {
3334
"history": [
3435
{
35-
"summary": "add ws"
36+
"summary": "add ws",
37+
"message": "add ws\n"
3638
}
3739
]
3840
}

tests/proxy/graphql_schema.t

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,22 @@
323323
}
324324
}
325325
},
326+
{
327+
"args": [],
328+
"deprecationReason": null,
329+
"description": null,
330+
"isDeprecated": false,
331+
"name": "message",
332+
"type": {
333+
"kind": "NON_NULL",
334+
"name": null,
335+
"ofType": {
336+
"kind": "SCALAR",
337+
"name": "String",
338+
"ofType": null
339+
}
340+
}
341+
},
326342
{
327343
"args": [
328344
{

0 commit comments

Comments
 (0)