Skip to content

Commit fe2064f

Browse files
Mauricio Cassolajoulei
authored andcommitted
Support hold as first command and post comment when no first vote
1 parent 73511bc commit fe2064f

File tree

4 files changed

+99
-269
lines changed

4 files changed

+99
-269
lines changed

parser/src/command/decision.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,32 @@ impl DecisionCommand {
2828
let mut toks = input.clone();
2929

3030
match toks.peek_token()? {
31-
Some(Token::Word("merge")) => {
32-
command_or_error(input, &mut toks, Self {
31+
Some(Token::Word("merge")) => command_or_error(
32+
input,
33+
&mut toks,
34+
Self {
3335
resolution: Resolution::Merge,
3436
reversibility: Reversibility::Reversible,
35-
})
36-
}
37-
Some(Token::Word("hold")) => {
38-
command_or_error(input, &mut toks, Self {
37+
},
38+
),
39+
Some(Token::Word("hold")) => command_or_error(
40+
input,
41+
&mut toks,
42+
Self {
3943
resolution: Resolution::Hold,
4044
reversibility: Reversibility::Reversible,
41-
})
42-
}
45+
},
46+
),
4347
_ => Ok(None),
4448
}
4549
}
4650
}
4751

48-
fn command_or_error<'a>(input: &mut Tokenizer<'a>, toks: &mut Tokenizer<'a>, command: DecisionCommand) -> Result<Option<DecisionCommand>, Error<'a>> {
52+
fn command_or_error<'a>(
53+
input: &mut Tokenizer<'a>,
54+
toks: &mut Tokenizer<'a>,
55+
command: DecisionCommand,
56+
) -> Result<Option<DecisionCommand>, Error<'a>> {
4957
toks.next_token()?;
5058
if let Some(Token::Dot) | Some(Token::EndOfLine) = toks.peek_token()? {
5159
*input = toks.clone();
@@ -70,7 +78,7 @@ impl fmt::Display for ParseError {
7078
}
7179
}
7280

73-
#[derive(Serialize, Deserialize, Debug, Clone, ToSql, FromSql, Eq, PartialEq)]
81+
#[derive(Serialize, Deserialize, Debug, Clone, Copy, ToSql, FromSql, Eq, PartialEq)]
7482
#[postgres(name = "reversibility")]
7583
pub enum Reversibility {
7684
#[postgres(name = "reversible")]

src/github.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,13 @@ impl Issue {
786786
#[derive(serde::Serialize)]
787787
struct MergeIssue<'a> {
788788
commit_title: &'a str,
789-
merge_method: &'a str
789+
merge_method: &'a str,
790790
}
791791

792792
client
793793
._send_req(client.put(&merge_url).json(&MergeIssue {
794794
commit_title: "Merged by the bot!",
795-
merge_method: "merge"
795+
merge_method: "merge",
796796
}))
797797
.await
798798
.context("failed to merge issue")?;

0 commit comments

Comments
 (0)