diff --git a/version/src/git.rs b/version/src/git.rs index 3d8b7834bc..946372caf1 100644 --- a/version/src/git.rs +++ b/version/src/git.rs @@ -95,9 +95,9 @@ fn get_path(file: DiffFile) -> String { return file.path().unwrap().to_str().unwrap().to_string(); } -pub fn has_pull_request() -> bool { +pub fn has_pull_request(version: String) -> bool { let url_repo = url_repo(); - let url_api = url_api(&url_repo); + let url_api = url_api(&url_repo, version); let client = Client::new().get(&url_api).header("User-Agent", ""); let response = client.send().unwrap(); @@ -111,14 +111,12 @@ fn url_repo() -> String { .url().unwrap().to_string(); } -fn url_api(url_repo: &str) -> String { +fn url_api(url_repo: &str, version: String) -> String { let pattern = r"git@github.com:(\w+)/(\w+).git"; let replacer = r"https://api.github.com/repos/$1/$2/pulls?state=open&head=$1:"; let replaced = replace(url_repo, pattern, replacer).unwrap(); - let branch = current_branch().unwrap(); - - return format!("{}{}", replaced, branch); + return format!("{}{}", replaced, version); } pub fn update_local() { diff --git a/version/src/version.rs b/version/src/version.rs index 79176e7339..2e70f7e2cb 100644 --- a/version/src/version.rs +++ b/version/src/version.rs @@ -31,7 +31,7 @@ pub fn create_version(option: &ProgramOption, numbers: Vec) -> Option, branch: String) -> usize { return start; } -fn end_not_done() -> Option { - if has_pull_request() { +fn end_not_done(version: String) -> Option { + if has_pull_request(version) { throw(11, "There is an opened pull request and the version is not done"); }