2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

better commit msg

This commit is contained in:
Philip Sargent 2022-08-16 21:58:13 +03:00
parent 03cda8a897
commit e195497829

View File

@ -261,7 +261,7 @@ def scanupload(request, path=None):
print(f'wallet string {walletname}, FAIL TO GET or create WALLET OBJECT')
raise
def commit_json():
def commit_json(waldata):
destfolder = contents_path.parent
dr_add = subprocess.run([git, "add", contentsjson], cwd=destfolder, capture_output=True, text=True)
if dr_add.returncode != 0:
@ -274,8 +274,15 @@ def scanupload(request, path=None):
comment = f"on dev machine '{socket.gethostname()}' "
else:
comment = ""
if waldata["cave"]:
label = waldata["cave"]
else:
if waldata["name"]:
label = waldata["name"]
else:
label = ""
dr_commit = subprocess.run([git, "commit", "-m", f'JSON update for wallet {wallet} {comment}'], cwd=destfolder, capture_output=True, text=True)
dr_commit = subprocess.run([git, "commit", "-m", f'JSON update wallet {wallet} {label} {comment}'], cwd=destfolder, capture_output=True, text=True)
# This produces return code = 1 if it commits OK
if dr_commit.returncode != 0:
msgdata = 'Ask a nerd to fix this.\n\n' + dr_commit.stderr + '\n\n' + dr_commit.stdout + '\n\nreturn code: ' + str(dr_commit.returncode)
@ -368,7 +375,7 @@ def scanupload(request, path=None):
save_json(wd)
make_wallet(wallet)
commit_json()
commit_json(wd)
else:
print(f'--- INVALID JSON Update form submitted')
@ -406,7 +413,7 @@ def scanupload(request, path=None):
filesaved = True
save_json(wallet_blank_json)
make_wallet(wallet)
commit_json()
commit_json(waldata)
files = []
dirs = []
# print(f'! - FORM scanupload - start {wallet} {dirpath}')