diff --git a/html/changelog.html b/html/changelog.html
index a05fd8e84da..b7c9b9661f6 100644
--- a/html/changelog.html
+++ b/html/changelog.html
@@ -84,6 +84,11 @@ ADDING CREDITS? EDIT templates/header.html (or footer.html if they're for old t
Dylanstrategie updated:
- Changed cloner functionality. Base cloning time has seen a pretty steep increase (between 3 and 6 minutes) but the cloning time and biomass use can be reduced by replacing the cloning pod's parts. This change should make cloning people less of a choice early in the round and reverse "clone everything" mentality with the recent changes to defibrillators and other planned changes
+ - R&D now makes HUDSunglasses instead of the old "Sec HUD" item
+
+ N3X15 updated:
+
+ - Added delete-after directive to changelog YML files.
diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml
index f62dcd5cc3a..6d430f1d047 100644
--- a/html/changelogs/.all_changelog.yml
+++ b/html/changelogs/.all_changelog.yml
@@ -703,3 +703,6 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.
by replacing the cloning pod's parts. This change should make cloning people
less of a choice early in the round and reverse "clone everything" mentality
with the recent changes to defibrillators and other planned changes
+ - bugfix: R&D now makes HUDSunglasses instead of the old "Sec HUD" item
+ N3X15:
+ - rscadd: Added delete-after directive to changelog YML files.
diff --git a/html/changelogs/Dylanstrategie.yml b/html/changelogs/Dylanstrategie.yml
index b255d461b46..dd74f9bfe2d 100644
--- a/html/changelogs/Dylanstrategie.yml
+++ b/html/changelogs/Dylanstrategie.yml
@@ -1,3 +1,2 @@
author: Dylanstrategie
-changes:
- - bugfix: R&D now makes HUDSunglasses instead of the old "Sec HUD" item
+changes: []
diff --git a/html/changelogs/example.yml b/html/changelogs/example.yml
index 203487117f0..623ed962800 100644
--- a/html/changelogs/example.yml
+++ b/html/changelogs/example.yml
@@ -24,6 +24,9 @@
# Your name.
author: N3X15
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+#delete-after: True
+
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
diff --git a/tools/ss13_genchangelog.py b/tools/ss13_genchangelog.py
index 0390b665a29..22064087716 100644
--- a/tools/ss13_genchangelog.py
+++ b/tools/ss13_genchangelog.py
@@ -125,31 +125,40 @@ if failed_cache_read and os.path.isfile(args.targetFile):
else:
all_changelog_entries[date] = entry
+del_after = []
+print('Reading changelogs...')
for fileName in glob.glob(os.path.join(args.ymlDir, "*.yml")):
name, ext = os.path.splitext(os.path.basename(fileName))
if name.startswith('.'): continue
if name == 'example': continue
+ fileName = os.path.abspath(fileName)
print(' Reading {}...'.format(fileName))
cl = {}
with open(fileName, 'r') as f:
cl = yaml.load(f)
+ f.close()
if today not in all_changelog_entries:
all_changelog_entries[today] = {}
author_entries = all_changelog_entries[today].get(cl['author'], [])
if len(cl['changes']):
+ new = 0
for change in cl['changes']:
- '''
- for css,comment in change.items():
- c=(css,comment)
- if c not in author_entries:
- author_entries += [c]
- '''
if change not in author_entries:
(change_type, _) = dictToTuples(change)[0]
if change_type not in validPrefixes:
print(' {0}: Invalid prefix {1}'.format(fileName, change_type), file=sys.stderr)
author_entries += [change]
+ new += 1
all_changelog_entries[today][cl['author']] = author_entries
+ if new > 0:
+ print(' Added {0} new changelog entries.'.format(new))
+
+ if cl.get('delete-after', False):
+ if os.path.isfile(fileName):
+ if args.dryRun:
+ print(' Would delete {0} (delete-after set)...'.format(fileName))
+ else:
+ del_after += [fileName]
if args.dryRun: continue
@@ -180,7 +189,7 @@ with open(args.targetFile.replace('.htm', '.dry.htm') if args.dryRun else args.t
changes_added += [change]
author_htm += '\t\t\t\t{change}\n'.format(css_class=css_class, change=change.strip())
author_htm += '\t\t\t\n'
- if len(changes_added)>0:
+ if len(changes_added) > 0:
entry_htm += author_htm
entry_htm += '\t\t\n'
if write_entry:
@@ -194,3 +203,10 @@ with open(args.targetFile.replace('.htm', '.dry.htm') if args.dryRun else args.t
with open(changelog_cache, 'w') as f:
cache_head = 'DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.'
yaml.dump_all([cache_head, all_changelog_entries], f, default_flow_style=False)
+
+if len(del_after):
+ print('Cleaning up...')
+ for fileName in del_after:
+ if os.path.isfile(fileName):
+ print(' Deleting {0} (delete-after set)...'.format(fileName))
+ os.remove(fileName)