diff options
author | Martin Green <martin.speleo@gmail.com> | 2023-04-30 21:04:05 +0100 |
---|---|---|
committer | Martin Green <martin.speleo@gmail.com> | 2023-04-30 21:04:05 +0100 |
commit | e8d1265ee4ab2f1adf235c90d755ec7123e48f71 (patch) | |
tree | 2846d7d67445faa4dabc3f2090b27e80a4b989db /core | |
parent | 10ff8a5aab1e4380989c589044e12c34ecbf70ce (diff) | |
download | troggle-e8d1265ee4ab2f1adf235c90d755ec7123e48f71.tar.gz troggle-e8d1265ee4ab2f1adf235c90d755ec7123e48f71.tar.bz2 troggle-e8d1265ee4ab2f1adf235c90d755ec7123e48f71.zip |
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.
Diffstat (limited to 'core')
-rw-r--r-- | core/utils.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/core/utils.py b/core/utils.py index fa62d48..66e0bdc 100644 --- a/core/utils.py +++ b/core/utils.py @@ -144,23 +144,23 @@ def write_and_commit(files, message): ) else: print(f"No change {filepath}") - subprocess.run([git, "commit", "-m", message], cwd=cwd, capture_output=True, text=True) - cp_status = subprocess.run([git, "status"], 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) # 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": - print("FOO: ", cp_status.stdout.split("\n")[-2]) - msgdata = ( - "Ask a nerd to fix this.\n\n" - + cp_status.stderr - + "\n\n" - + cp_status.stdout - + "\n\nreturn code: " - + str(cp_status.returncode) - ) - raise WriteAndCommitError( - f"Error code with git on server for this file {filename}. Edits saved, added to git, but NOT committed.\n\n" - + msgdata - ) + #if cp_status.stdout.split("\n")[-2] != "nothing to commit, working tree clean": + # print("FOO: ", cp_status.stdout.split("\n")[-2]) + # msgdata = ( + # "Ask a nerd to fix this.\n\n" + # + cp_status.stderr + # + "\n\n" + # + cp_status.stdout + # + "\n\nreturn code: " + # + str(cp_status.returncode) + # ) + # raise WriteAndCommitError( + # f"Error code with git on server for this file {filename}. Edits saved, added to git, but NOT committed.\n\n" + # + msgdata + # ) except subprocess.SubprocessError: raise WriteAndCommitError( f"CANNOT git on server for this file {filename}. Subprocess error. Edits not saved.\nAsk a nerd to fix this." |