def check_credentials(): output = pbtools.get_one_line_output(["git", "config", "user.name"]) if output == "" or output is None: user_name = input("Please enter your GitHub username: "******"git", "config", "user.name", user_name]) output = pbtools.get_one_line_output(["git", "config", "user.email"]) if output == "" or output is None: user_mail = input("Please enter your GitHub email: ") pbtools.run_with_output(["git", "config", "user.email", user_mail])
def check_remote_connection(): current_url = pbtools.get_one_line_output( ["git", "remote", "get-url", "origin"]) recent_url = pbconfig.get("git_url") if current_url != recent_url: output = pbtools.get_combined_output( ["git", "remote", "set-url", "origin", recent_url]) pblog.info(output) current_url = pbtools.get_one_line_output( ["git", "remote", "get-url", "origin"]) out = pbtools.run_with_output(["git", "ls-remote", "--exit-code", "-h"]).returncode return out == 0, current_url
def get_lfs_version(): installed_version_split = pbtools.get_one_line_output( ["git", "lfs", "--version"]).split(" ") if len(installed_version_split) == 0: return None # Get first index as full version of git-lfs installed_version = str(installed_version_split[0]) if installed_version == "": return None return installed_version
def get_git_version(): installed_version_split = pbtools.get_one_line_output(["git", "--version" ]).split(" ") list_len = len(installed_version_split) if list_len == 0: return None # Get latest index as full version of git installed_version = str(installed_version_split[list_len - 1]) if installed_version == "": return None return installed_version
def get_current_branch_name(): return pbtools.get_one_line_output(["git", "branch", "--show-current"])