"Update push_git.py"
This commit is contained in:
parent
f7e0933345
commit
16f500a92d
|
@ -16,8 +16,6 @@ def get_yes_no_answer(question: str, error_msg: str = "ERROR: Malformed input!")
|
|||
print(f"{question} (y,n): ", end="")
|
||||
ans = input().lower().strip()
|
||||
|
||||
print(f"Input: \"{ans}\"");
|
||||
|
||||
if ans == "y":
|
||||
return True
|
||||
elif ans == "n":
|
||||
|
@ -78,7 +76,7 @@ def stage_git_changes(repo: Repo):
|
|||
# TODO: Check for the staged changes also
|
||||
diff = repo.index.diff(None)
|
||||
|
||||
if len(diff) == 0:
|
||||
""" if len(diff) == 0:
|
||||
diff = repo.index.diff("HEAD")
|
||||
|
||||
if len(diff) == 0:
|
||||
|
@ -86,9 +84,11 @@ def stage_git_changes(repo: Repo):
|
|||
exit()
|
||||
else:
|
||||
print("All changes are already staged...")
|
||||
return
|
||||
return """
|
||||
|
||||
print("Git diff:")
|
||||
""" print("Git diff:")
|
||||
status = repo.git.status()
|
||||
print(status)
|
||||
for item in diff:
|
||||
if item.deleted_file:
|
||||
print(f" D - {item.a_path}")
|
||||
|
@ -105,13 +105,16 @@ def stage_git_changes(repo: Repo):
|
|||
else:
|
||||
print(f" C - {item.a_path}")
|
||||
|
||||
file_diff_list.append(os.path.join(repo.working_tree_dir, item.a_path))
|
||||
file_diff_list.append(os.path.join(repo.working_tree_dir, item.a_path)) """
|
||||
|
||||
ans = get_yes_no_answer("Stage entire diff?")
|
||||
ans = get_yes_no_answer("Stage all changes?")
|
||||
|
||||
if ans:
|
||||
for diff in file_diff_list:
|
||||
repo.git.add(diff)
|
||||
""" for diff in file_diff_list:
|
||||
repo.git.add(diff) """
|
||||
repo.git.add(".")
|
||||
status = repo.git.status()
|
||||
print(status)
|
||||
|
||||
print("Staged all changes")
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue