Allow use of the --project flag in polling mode, not just with --mbox
diff mbox

Message ID 1468903609-27278-1-git-send-email-andrew.donnellan@au1.ibm.com
State Superseded
Headers show

Commit Message

Andrew Donnellan July 19, 2016, 4:46 a.m. UTC
A user may want to run snowpatch in normal patchwork polling mode, but only
test one particular project. Expand the --project flag so it can be used
for this case.

Closes: #22 ("Allow use of --project switch in normal mode, not just with
--mbox")
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
 src/main.rs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Andrew Donnellan Nov. 21, 2016, 9:03 a.m. UTC | #1
On 19/07/16 14:46, Andrew Donnellan wrote:
> A user may want to run snowpatch in normal patchwork polling mode, but only
> test one particular project. Expand the --project flag so it can be used
> for this case.
>
> Closes: #22 ("Allow use of --project switch in normal mode, not just with
> --mbox")
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

Was there a reason we didn't merge this?
Russell Currey Nov. 21, 2016, 9:10 a.m. UTC | #2
On Mon, 2016-11-21 at 20:03 +1100, Andrew Donnellan wrote:
> On 19/07/16 14:46, Andrew Donnellan wrote:
> > A user may want to run snowpatch in normal patchwork polling mode, but only
> > test one particular project. Expand the --project flag so it can be used
> > for this case.
> > 
> > Closes: #22 ("Allow use of --project switch in normal mode, not just with
> > --mbox")
> > Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> 
> Was there a reason we didn't merge this?
> 
I probably just forgot.
Andrew Donnellan Nov. 22, 2016, 12:51 a.m. UTC | #3
On 21/11/16 20:10, Russell Currey wrote:
>> Was there a reason we didn't merge this?
>>
> I probably just forgot.

As it turns out, perhaps because it doesn't build...

V2 incoming.

Patch
diff mbox

diff --git a/src/main.rs b/src/main.rs
index 57fd5ad..b203b10 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -64,8 +64,8 @@  mod utils;
 
 static USAGE: &'static str = "
 Usage:
-  snowpatch <config-file> [--count=<count> | --series <id>]
-  snowpatch <config-file> --mbox=<mbox> --project=<name>
+  snowpatch <config-file> [--count=<count> | --series <id>] [--project <name>]
+  snowpatch <config-file> --mbox <mbox> --project <name>
   snowpatch -v | --version
   snowpatch -h | --help
 
@@ -74,8 +74,8 @@  By default, snowpatch runs as a long-running daemon.
 Options:
   --count <count>           Run tests on <count> recent series.
   --series <id>             Run tests on the given Patchwork series.
-  --mbox <mbox>             Run tests on the given mbox file...
-  --project <name>          ...as if it were sent to project <name>.
+  --mbox <mbox>             Run tests on the given mbox file. Requires --project
+  --project <name>          Test patches for the given project.
   -v, --version             Output version information.
   -h, --help                Output this help text.
 ";
@@ -325,6 +325,12 @@  fn main() {
                 continue;
             }
 
+            // Skip if we're using -p and it's the wrong project
+            if args.flag_project != "" && series.project.linkname != args.flag_project {
+                debug!("Skipping series {} (wrong project: {})", series.project.linkname);
+                continue;
+            }
+
             match settings.projects.get(&series.project.linkname) {
                 None => {
                     debug!("Project {} not configured for series {} ({})",