2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 19:37:09 +00:00

Add commit msg when on a devserver

This commit is contained in:
2024-12-29 15:49:07 +00:00
parent 6d2484376a
commit ace2325773
4 changed files with 16 additions and 12 deletions

View File

@@ -19,9 +19,13 @@ https://docs.djangoproject.com/en/dev/topics/testing/tools/
"""
todo = """ADD TESTS when we are redirecting /expofiles/ to a remote file-delivering site
todo = """ - ADD TESTS when we are redirecting /expofiles/ to a remote file-delivering site
- Add test for running cavern to produce a .3d file
- Add tests for editing the TXT files
- add "author" tests for the git add and commit stuff for uploaded files, inc on DEVSERVER or not
"""
import re

View File

@@ -5,6 +5,7 @@ import os
import random
import re
import resource
import socket
import string
import subprocess
from datetime import datetime, timezone
@@ -45,6 +46,8 @@ sha = hashlib.new('sha256')
COOKIE_MAX_AGE = 12*60*60 # seconds
throw = 35.0
EXPOSERVER = "expo" # hostname of the server at expo.survex.com
DEV_OK = """On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
@@ -260,7 +263,12 @@ def git_commit(cwd, message, editor, commands=[]):
"""
git = settings.GIT
print(f"git commit in {cwd}")
print(f"Committing:\n{message=}\n{editor=}")
if socket.gethostname() != EXPOSERVER:
message += f" on dev machine '{socket.gethostname()}'"
elif settings.DEVSERVER:
message += " on a dev machine using 'runserver'"
print(f"..{message=}\n..{editor=}")
cmd_commit = [git, "commit", "-m", message, "--author", f"{editor}"]
commands.append(cmd_commit)

View File

@@ -2,7 +2,6 @@ import datetime
import difflib
import os
import re
import socket
from collections import namedtuple
from pathlib import Path
@@ -229,11 +228,7 @@ class SvxForm(forms.Form):
fout.write("\n")
fout.close()
if socket.gethostname() == "expo":
comment = f"Online survex edit: {self.data['filename']}.svx"
else:
comment = f"Online survex edit: {self.data['filename']}.svx on dev machine '{socket.gethostname()}' "
print(f"Committing file which has been saved {editor=}")
add_commit(fname, comment, editor)
msg = f"SAVED and committed to git (if there were differences)\nEdited by:{editor}"

View File

@@ -26,12 +26,9 @@ So is the first thing that creates tables.
"""
todo = """
- When reading cave data, to start off wit we do not know the cave id (slug) so we can't give a useful url in
- When reading cave data, to start off with we do not know the cave id (slug) so we can't give a useful url in
the error message, but we do have the filename. Systematize this, and the same thing with reading entrance files.
- Cannot use Edit This Page for pendingcaves.txt_edit as Edit This Page is expecting an html file.
So we will need a separate file-editing capability just for this configuration file ?!
- we want to overwrite a PENDING cave if we are now importing the 1623-xxx.html file for it
- rewrite archaic regex