def branches(folder): # statement = "cd " + folder + ";" + "git ls-remote --heads origin" statement = f"cd {folder};git ls-remote --heads origin" output = command.execute(statement) output = command.stringify(output) # p = Popen([statement], stdout=PIPE, shell=True) # output, error = p.communicate() # if p.returncode != 0: # raise PluginException(error) lines = output.split("\n") results = [] for line in lines: if line: results.append(line.split("\t")[1].replace('refs/heads/', '')) return results
def checkout(version, folder): output = command.execute(f"cd {folder};git checkout {version}") return command.stringify(output)
def push(repository, branch, folder): output = command.execute(f"cd {folder};git push --tags {repository} {branch}") return command.stringify(output)
def tag(version, folder): output = command.execute(f"cd {folder}; git tag -a {version} -m '{version}'") return command.stringify(output)
def commit(version, folder): output = command.execute(f"cd {folder};git commit -a --message='updated to version {version}'") return command.stringify(output)
def clone(repository, folder): output = command.execute(f"git clone {repository} {folder}") return command.stringify(output)
def upload(folder, username, password): output = command.execute( f"cd {folder};twine upload --username {username} --password '{password}' dist/*" ) return command.stringify(output)
def build(folder): output = command.execute(f"cd {folder};python3 -m build", print_output=True) return command.stringify(output)