Message ID | 20180731063817.13186-1-andrew.donnellan@au1.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | Fix --series option | expand |
On 31/07/18 16:38, Andrew Donnellan wrote: > Somewhere along the way, we completely broke the --series option and failed > to notice. > > It appears we try to retrieve a Project over the Patchwork API and pass an > entirely invalid URL. As it turns out we can just use the Project already > retrieved as part of the Patch that we already retrieve, so use that > instead. > > (This is why we need tests, which we ironically don't yet have...) > > Reported-by: Russell Currey <ruscur@russell.cc> > Closes: #43 ("Fix --series") > Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Applied to master: b92930de2ecbacf37812352e7b2d02ea80bf8a80
diff --git a/src/main.rs b/src/main.rs index eb7ffc1ee36d..3102cf82e972 100644 --- a/src/main.rs +++ b/src/main.rs @@ -370,10 +370,8 @@ fn main() { let patch = patchwork .get_patch_by_url(&series.patches.last().unwrap().url) .unwrap(); - // We have to do it this way since there's no project field on Series - let project = patchwork.get_project(&patch.project.name).unwrap(); - match settings.projects.get(&project.link_name) { - None => panic!("Couldn't find project {}", &project.link_name), + match settings.projects.get(&patch.project.link_name) { + None => panic!("Couldn't find project {}", &patch.project.link_name), Some(project) => { let dependencies = patchwork.get_patch_dependencies(&patch); let mbox = patchwork.get_patches_mbox(dependencies); diff --git a/src/patchwork.rs b/src/patchwork.rs index 378c6ca9de70..c9c335472496 100644 --- a/src/patchwork.rs +++ b/src/patchwork.rs @@ -284,10 +284,6 @@ impl PatchworkServer { Ok(resp.status()) } - pub fn get_project(&self, url: &str) -> Result<Project, serde_json::Error> { - serde_json::from_str(&self.get_url_string(url).unwrap()) - } - pub fn get_patch(&self, patch_id: &u64) -> Result<Patch, serde_json::Error> { let url = format!( "{}{}/patches/{}{}",
Somewhere along the way, we completely broke the --series option and failed to notice. It appears we try to retrieve a Project over the Patchwork API and pass an entirely invalid URL. As it turns out we can just use the Project already retrieved as part of the Patch that we already retrieve, so use that instead. (This is why we need tests, which we ironically don't yet have...) Reported-by: Russell Currey <ruscur@russell.cc> Closes: #43 ("Fix --series") Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> --- src/main.rs | 6 ++---- src/patchwork.rs | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-)