forked from expo/troggle
Be more specific about what is being commited and do not check for unadded changes, and then through an error at the user, which they are unlikely to understand.
This commit is contained in:
parent
10ff8a5aab
commit
e8d1265ee4
@ -144,23 +144,23 @@ def write_and_commit(files, message):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print(f"No change {filepath}")
|
print(f"No change {filepath}")
|
||||||
subprocess.run([git, "commit", "-m", message], cwd=cwd, capture_output=True, text=True)
|
subprocess.run([git, "commit", filename, "-m", message], cwd=cwd, capture_output=True, text=True)
|
||||||
cp_status = subprocess.run([git, "status"], cwd=cwd, capture_output=True, text=True)
|
#cp_status = subprocess.run([git, "status"], cwd=cwd, capture_output=True, text=True)
|
||||||
# This produces return code = 1 if it commits OK, but when the repo still needs to be pushed to origin/expoweb
|
# This produces return code = 1 if it commits OK, but when the repo still needs to be pushed to origin/expoweb
|
||||||
if cp_status.stdout.split("\n")[-2] != "nothing to commit, working tree clean":
|
#if cp_status.stdout.split("\n")[-2] != "nothing to commit, working tree clean":
|
||||||
print("FOO: ", cp_status.stdout.split("\n")[-2])
|
# print("FOO: ", cp_status.stdout.split("\n")[-2])
|
||||||
msgdata = (
|
# msgdata = (
|
||||||
"Ask a nerd to fix this.\n\n"
|
# "Ask a nerd to fix this.\n\n"
|
||||||
+ cp_status.stderr
|
# + cp_status.stderr
|
||||||
+ "\n\n"
|
# + "\n\n"
|
||||||
+ cp_status.stdout
|
# + cp_status.stdout
|
||||||
+ "\n\nreturn code: "
|
# + "\n\nreturn code: "
|
||||||
+ str(cp_status.returncode)
|
# + str(cp_status.returncode)
|
||||||
)
|
# )
|
||||||
raise WriteAndCommitError(
|
# raise WriteAndCommitError(
|
||||||
f"Error code with git on server for this file {filename}. Edits saved, added to git, but NOT committed.\n\n"
|
# f"Error code with git on server for this file {filename}. Edits saved, added to git, but NOT committed.\n\n"
|
||||||
+ msgdata
|
# + msgdata
|
||||||
)
|
# )
|
||||||
except subprocess.SubprocessError:
|
except subprocess.SubprocessError:
|
||||||
raise WriteAndCommitError(
|
raise WriteAndCommitError(
|
||||||
f"CANNOT git on server for this file {filename}. Subprocess error. Edits not saved.\nAsk a nerd to fix this."
|
f"CANNOT git on server for this file {filename}. Subprocess error. Edits not saved.\nAsk a nerd to fix this."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user