Loading robot2doc/create_sols.py +27 −7 Original line number Diff line number Diff line Loading @@ -161,6 +161,20 @@ def parse_commit_from_log(gitlog): return commit.group(1) if bool(commit) else None def parse_branch_from_log(gitlog): ''' Returns the current git branch or None if the last commit is not parsed ''' branch = re.search(r"(origin/)(\d+(\.?\d)+)(-dev)",gitlog) branch_master = re.search(r"(origin/)(master)",master) if bool(branch): return branch.group(2) else if bool(branch_master): return branch_master.group(2) else return None def get_git_reference(folder): ''' Reads the tag or commit reference. Returns a couple (ref, reftype) where Loading @@ -170,16 +184,17 @@ def get_git_reference(folder): git_log = get_git_log(folder) tag = parse_tag_from_log(git_log) commit = parse_commit_from_log(git_log) branch = parse_branch_from_log(git_log) if tag is not None: return (tag, "tag") return (tag, "tag", branch) if commit is not None: return (commit, "commit") return (commit, "commit", branch) print("Could not parse tag or commit locally. (Git log: '{}')".format(git_log)) return (None, None) return (None, None, branch) if __name__ == "__main__": Loading @@ -197,17 +212,22 @@ if __name__ == "__main__": print("Received arguments: ", sys.argv) if COMMIT_ID == "local": (REF, REF_TYPE) = get_git_reference(ROOT) (REF, REF_TYPE, BRANCH) = get_git_reference(ROOT) if REF is None: sys.exit(-1) COMMIT_ID = REF print("Using git ref: {} ({})".format(COMMIT_ID, REF_TYPE)) print("Using git ref: {} ({})".format(COMMIT_ID, REF_TYPE, BRANCH)) print("Generating entire SOL tests") if BRANCH =~ 3.*$ : sol_specs = ["SOL002", "SOL003", "SOL005", "SOL009", "SOL011", "SOL012"] else if (BRANCH =~ 2.*$ || BRANCH == "master") : sol_specs = ["SOL002", "SOL003", "SOL005"] else print("Could not determine branch") for solspec in sol_specs: spec_index = load_spec_index(ROOT, solspec) Loading Loading
robot2doc/create_sols.py +27 −7 Original line number Diff line number Diff line Loading @@ -161,6 +161,20 @@ def parse_commit_from_log(gitlog): return commit.group(1) if bool(commit) else None def parse_branch_from_log(gitlog): ''' Returns the current git branch or None if the last commit is not parsed ''' branch = re.search(r"(origin/)(\d+(\.?\d)+)(-dev)",gitlog) branch_master = re.search(r"(origin/)(master)",master) if bool(branch): return branch.group(2) else if bool(branch_master): return branch_master.group(2) else return None def get_git_reference(folder): ''' Reads the tag or commit reference. Returns a couple (ref, reftype) where Loading @@ -170,16 +184,17 @@ def get_git_reference(folder): git_log = get_git_log(folder) tag = parse_tag_from_log(git_log) commit = parse_commit_from_log(git_log) branch = parse_branch_from_log(git_log) if tag is not None: return (tag, "tag") return (tag, "tag", branch) if commit is not None: return (commit, "commit") return (commit, "commit", branch) print("Could not parse tag or commit locally. (Git log: '{}')".format(git_log)) return (None, None) return (None, None, branch) if __name__ == "__main__": Loading @@ -197,17 +212,22 @@ if __name__ == "__main__": print("Received arguments: ", sys.argv) if COMMIT_ID == "local": (REF, REF_TYPE) = get_git_reference(ROOT) (REF, REF_TYPE, BRANCH) = get_git_reference(ROOT) if REF is None: sys.exit(-1) COMMIT_ID = REF print("Using git ref: {} ({})".format(COMMIT_ID, REF_TYPE)) print("Using git ref: {} ({})".format(COMMIT_ID, REF_TYPE, BRANCH)) print("Generating entire SOL tests") if BRANCH =~ 3.*$ : sol_specs = ["SOL002", "SOL003", "SOL005", "SOL009", "SOL011", "SOL012"] else if (BRANCH =~ 2.*$ || BRANCH == "master") : sol_specs = ["SOL002", "SOL003", "SOL005"] else print("Could not determine branch") for solspec in sol_specs: spec_index = load_spec_index(ROOT, solspec) Loading