Skip to content

Commit e2b70fb

Browse files
added rollup mode management
1 parent 1f773b3 commit e2b70fb

18 files changed

+754
-50
lines changed

.sqlx/query-ad1e4676b67caa18bd10c4d9e727950e437d538a747b18ecbf1206ef6b148dc9.json renamed to .sqlx/query-7efe43b9bd54cc798a81cfe8c4a1ef396044c382b6f5172fb389175d8ce1346e.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-a7498731ebc2ae95a48c52046eb9377656acd7bb2907000abcbee1c7ce90ad43.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-c4b0d4ed216c6b8efceb1b65ae0ad9d830e8870cfdf37542a408b99c961318f7.json renamed to .sqlx/query-aaceccc739564492d8424e6951f9c272c88dd4d34199c7ee4346462867029823.json

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-f223617621c400f216ecfe415f0bf54a0f8cfb8aecace69b5d53cb888e5c9fa4.json renamed to .sqlx/query-bf90bc08fff5e3cb3c75342b097c60947a857b74ecc21320c94a816090ef04df.json

Lines changed: 10 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Add up migration script here
2+
ALTER TABLE pull_request DROP COLUMN rollup;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Add up migration script here
2+
ALTER TABLE pull_request ADD COLUMN rollup TEXT;

src/bors/command/mod.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
mod parser;
2+
use std::fmt;
3+
use std::str::FromStr;
4+
25
use crate::github::CommitSha;
36
pub use parser::{CommandParseError, CommandParser};
47

@@ -22,6 +25,42 @@ pub enum Approver {
2225
Specified(String),
2326
}
2427

28+
const ROLLUP_VALUES: [&str; 4] = ["always", "iffy", "maybe", "never"];
29+
30+
#[derive(Copy, Clone, Debug, PartialEq)]
31+
pub enum RollupMode {
32+
Always,
33+
Iffy,
34+
Maybe,
35+
Never,
36+
}
37+
38+
impl fmt::Display for RollupMode {
39+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
40+
let s = match self {
41+
RollupMode::Always => "always",
42+
RollupMode::Iffy => "iffy",
43+
RollupMode::Never => "never",
44+
RollupMode::Maybe => "maybe",
45+
};
46+
write!(f, "{}", s)
47+
}
48+
}
49+
50+
impl FromStr for RollupMode {
51+
type Err = ();
52+
53+
fn from_str(s: &str) -> Result<Self, Self::Err> {
54+
match s {
55+
"always" => Ok(RollupMode::Always),
56+
"iffy" => Ok(RollupMode::Iffy),
57+
"never" => Ok(RollupMode::Never),
58+
"maybe" => Ok(RollupMode::Maybe),
59+
_ => Err(()),
60+
}
61+
}
62+
}
63+
2564
/// Bors command specified by a user.
2665
#[derive(Debug, PartialEq)]
2766
pub enum BorsCommand {
@@ -31,6 +70,8 @@ pub enum BorsCommand {
3170
approver: Approver,
3271
/// Priority of the commit.
3372
priority: Option<Priority>,
73+
// Rollup status of the commit.
74+
rollup: Option<RollupMode>,
3475
},
3576
/// Unapprove a commit.
3677
Unapprove,
@@ -53,4 +94,6 @@ pub enum BorsCommand {
5394
Delegate,
5495
/// Revoke any previously granted delegation.
5596
Undelegate,
97+
/// Rollup status.
98+
Rollup(RollupMode),
5699
}

0 commit comments

Comments
 (0)