Skip to content

Commit

Permalink
Add documentation category in changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
zoewangg committed Jan 25, 2021
1 parent f48fa01 commit d66faeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions scripts/changelog/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def write_changes(self, changes):
self.write_items_for_category(s, self.bugfixes, "Bugfixes")
self.write_items_for_category(s, self.deprecations, "Deprecations")
self.write_items_for_category(s, self.removals, "Removals")
self.write_items_for_category(s, self.documentations, "Documentations")
self.write_contributors()

def write_contributors(self):
Expand Down Expand Up @@ -57,6 +58,7 @@ def reset_maps(self):
self.bugfixes = {}
self.deprecations = {}
self.removals = {}
self.documentations = {}
self.categories = set()

def group_entries(self):
Expand Down Expand Up @@ -117,6 +119,8 @@ def get_map_for_type(self, t):
return self.deprecations
elif t == 'removal':
return self.removals
elif t == 'documentation':
return self.documentations
else:
raise Exception("Unknown entry type %s!" % t)

Expand Down
10 changes: 6 additions & 4 deletions scripts/new-change
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To generate a new changelog entry::
This will open up a file in your editor (via the ``EDITOR`` env var).
You'll see this template::
# Type should be one of: feature, bugfix, deprecation, removal
# Type should be one of: feature, bugfix, deprecation, removal, documentation
type: {change_type}
# The marketing name of the service this change applies to
Expand Down Expand Up @@ -53,7 +53,7 @@ CHANGES_DIR = os.path.join(
)
CHANGE_PARTS = ['type', 'category', 'description']
TEMPLATE = """\
# Type should be one of: feature, bugfix, deprecation, removal
# Type should be one of: feature, bugfix, deprecation, removal, documentation
type: {change_type}
# The marketing name of the service this change applies to
Expand Down Expand Up @@ -189,7 +189,8 @@ def parse_filled_in_contents(contents):
continue
if 'type' not in parsed and line.startswith('type:'):
t = line[len('type:'):].strip()
if t not in ['feature', 'bugfix', 'deprecation', 'removal']:
if t not in ['feature', 'bugfix', 'deprecation', 'removal',
'documentation']:
raise Exception("Unsupported category %s" % t)
parsed['type'] = t
elif 'category' not in parsed and line.startswith('category:'):
Expand All @@ -210,7 +211,8 @@ def parse_filled_in_contents(contents):
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--type', dest='change_type',
default='', choices=('bugfix', 'feature', 'deprecation'))
default='', choices=('bugfix', 'feature',
'deprecation', 'documentation'))
parser.add_argument('-c', '--category', dest='category',
default='')
parser.add_argument('-u', '--contributor', dest='contributor',
Expand Down

0 comments on commit d66faeb

Please sign in to comment.