mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-02-18 05:00:13 +00:00
auto git auto created files
This commit is contained in:
parent
d970942f04
commit
dbfe72071e
@ -103,11 +103,10 @@ def make_new_expo_dir(year):
|
|||||||
if not year_dir.is_dir():
|
if not year_dir.is_dir():
|
||||||
year_dir.mkdir(parents=True, exist_ok=True)
|
year_dir.mkdir(parents=True, exist_ok=True)
|
||||||
for ff in ["index","logbook", "mission"]:
|
for ff in ["index","logbook", "mission"]:
|
||||||
|
content = f"<html><head><title>{ff}</title></head><body><h1>{ff}</h1>{t}</body></html>"
|
||||||
p = Path(year_dir, ff+".html")
|
p = Path(year_dir, ff+".html")
|
||||||
if not p.is_file():
|
if not p.is_file():
|
||||||
p.write_text(f"<html><head><title>{ff}</title></head><body><h1>{ff}</h1>{t}</body></html>")
|
writetrogglefile(p, content, commit_msg="Auto new year file creation")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def current_expo():
|
def current_expo():
|
||||||
@ -281,7 +280,7 @@ class WriteAndCommitError(Exception):
|
|||||||
return f"WriteAndCommitError: {self.message}"
|
return f"WriteAndCommitError: {self.message}"
|
||||||
|
|
||||||
|
|
||||||
def writetrogglefile(filepath, filecontent):
|
def writetrogglefile(filepath, filecontent, commit_msg=None):
|
||||||
"""
|
"""
|
||||||
REPLACE with call to write_and_commit + any necessary setup
|
REPLACE with call to write_and_commit + any necessary setup
|
||||||
|
|
||||||
@ -308,8 +307,10 @@ def writetrogglefile(filepath, filecontent):
|
|||||||
out = out[:75] + "\n <Long output curtailed>\n" + out[-75:]
|
out = out[:75] + "\n <Long output curtailed>\n" + out[-75:]
|
||||||
print(f"git ADD {cwd}:\n\n" + str(sp.stderr) + "\n\n" + out + "\n\nreturn code: " + str(sp.returncode))
|
print(f"git ADD {cwd}:\n\n" + str(sp.stderr) + "\n\n" + out + "\n\nreturn code: " + str(sp.returncode))
|
||||||
|
|
||||||
|
if not commit_msg:
|
||||||
|
commit_msg = f"Troggle online: cave or entrance edit -{filename}"
|
||||||
sp = subprocess.run(
|
sp = subprocess.run(
|
||||||
[git, "commit", "-m", f"Troggle online: cave or entrance edit -{filename}"],
|
[git, "commit", "-m", commit_msg],
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
check=True,
|
check=True,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user