Skip to content

Commit

Permalink
prepare 0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Nov 18, 2019
1 parent d68ce53 commit e05b861
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .matyan.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ exact: more
more on
wip
commit
prefix: more on
continue on
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ version 0.0.3.
generate-changelog master..dev --show-releases
**Generate changelog for the latest release with releases info shown**

.. code-block:: sh
generate-changelog --latest-release --show-releases
Configuration
=============
In order to customize names and texts, add a ``.matyan.ini`` in your
Expand Down Expand Up @@ -130,6 +136,9 @@ Sample configuration:
more on
wip
commit
prefix: more on
continue on
Tips and tricks
===============
Expand Down
12 changes: 6 additions & 6 deletions TODOS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ TODOS
+ Add releases (group by releases) and actually, switch to releases and deprecate
old system, since it's irrelevant. It's always desired to show changelog by
releases. Think about the first tree item - 'Unreleased'. The rest are tags.
- Flexible regex patterns.
- Add from and to (``generate-changelog 0.1..0.2``).
- Make it possible to provide ignore patterns for commits and releases.
+ Add from and to (``generate-changelog 0.1..0.2``).
+ Add output to file. Documented how to write to file instead.
- Add tests.
+ Add tests.
+ Create initial config file.
+ Add a command for generating the changelog for latest release.
- Make it possible to provide ignore patterns for commits and releases.
- Flexible regex patterns.
- Make it possible to provide a template for generated changelog file.
- Create initial config file.
- Add a command for generating the changelog for latest release.
1 change: 1 addition & 0 deletions docs/documentation.rst.distrib
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Contents:

index
basic_concepts
methodology
changelog
matyan

Expand Down
20 changes: 20 additions & 0 deletions docs/methodology.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Methodology
===========
- Protect your main (DTAP) branches from direct commits. Commits shall only
arrive into these branches via pull request.
- Use feature branches. Make your own prefixes (or use current ones) for
classification of the ticket. Add ticket name to the name of the branch,
followed by slugified ticket title.
- Prefix commits with ticket number followed by meaningful description.

Sample branch names:

- ``bugfix/MSFT-1240-LinkedIn-authentication-failing``
- ``deprecation/MSFT-1239-Deprecate-Python2``
- ``feature/MSFT-1238-Token-authentication``

Sample commit messages:

- ``MSFT-1240 Fix package configuration.``
- ``MSFT-1239 Deprecate Python2.``
- ``MSFT-1238 Implement token authentication.``
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except:
readme = ''

version = '0.1'
version = '0.2'

setup(
name='matyan',
Expand Down
2 changes: 2 additions & 0 deletions src/matyan/.matyan.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ exact: more
more on
wip
commit
prefix: more on
continue on
2 changes: 1 addition & 1 deletion src/matyan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
)

__title__ = 'matyan'
__version__ = '0.0.2'
__version__ = '0.2'
__author__ = 'Artur Barseghyan'
__copyright__ = '2019 Artur Barseghyan'
__license__ = 'GPL-2.0-only OR LGPL-2.0-or-later'
Expand Down
15 changes: 12 additions & 3 deletions src/matyan/labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
__copyright__ = '2019 Artur Barseghyan'
__license__ = 'GPL-2.0-only OR LGPL-2.0-or-later'
__all__ = (
'get_all_branch_types',
'get_branch_types',
'get_ignore_commits_exact_words',
'get_ignore_commits_prefixes',
'get_other_branch_type',
'get_all_branch_types',
'get_unreleased',
'get_other_branch_type_key',
'get_unreleased',
'get_unreleased_key',
'get_unreleased_key_label',
'get_ignore_commits_exact_words',
)


Expand Down Expand Up @@ -75,3 +76,11 @@ def get_ignore_commits_exact_words() -> List[str]:
:return:
"""
return CONFIG['IgnoreCommits']['exact'].split('\n')


def get_ignore_commits_prefixes() -> List[str]:
"""Get ignore commits prefixes.
:return:
"""
return CONFIG['IgnoreCommits']['prefix'].split('\n')
5 changes: 3 additions & 2 deletions src/matyan/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
__copyright__ = '2019 Artur Barseghyan'
__license__ = 'GPL-2.0-only OR LGPL-2.0-or-later'
__all__ = (
'REGEX_PATTERN_BRANCH_TYPE',
'REGEX_PATTERN_BRANCH_NAME',
'REGEX_PATTERN_MERGED_BRANCH_NAME',
'REGEX_PATTERN_BRANCH_TYPE',
'REGEX_PATTERN_COMMIT',
'REGEX_PATTERN_COMMIT_LINE',
'REGEX_PATTERN_MERGED_BRANCH_NAME',
'REGEX_PATTERN_TAG',
)

Expand Down Expand Up @@ -48,4 +48,5 @@ def get_branch_types_for_regex() -> str:
REGEX_PATTERN_COMMIT + \
r'\s?(?P<commit_message>.*)'


REGEX_PATTERN_TAG = r'(?P<tag>((\d{1,9}\.)+(\d)+))'
17 changes: 13 additions & 4 deletions src/matyan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@

from .labels import (
get_all_branch_types,
get_other_branch_type,
get_branch_types,
get_unreleased,
get_ignore_commits_exact_words,
get_ignore_commits_prefixes,
get_other_branch_type,
get_other_branch_type_key,
get_unreleased,
get_unreleased_key,
get_unreleased_key_label,
get_ignore_commits_exact_words,
)
from .helpers import project_dir
from .patterns import (
REGEX_PATTERN_BRANCH_NAME,
REGEX_PATTERN_MERGED_BRANCH_NAME,
REGEX_PATTERN_COMMIT,
REGEX_PATTERN_COMMIT_LINE,
REGEX_PATTERN_MERGED_BRANCH_NAME,
REGEX_PATTERN_TAG,
)

Expand Down Expand Up @@ -292,6 +293,10 @@ def prepare_changelog(
if commit_message.lower() in IGNORE_COMMITS_EXACT_WORDS:
continue

for ignore_prefix in get_ignore_commits_prefixes():
if commit_message.lower().startswith(ignore_prefix):
continue

commit_hash = commit_message \
if unique_commit_messages \
else entry['commit_hash']
Expand Down Expand Up @@ -480,6 +485,10 @@ def prepare_releases_changelog(
if commit_message.lower() in IGNORE_COMMITS_EXACT_WORDS:
continue

for ignore_prefix in get_ignore_commits_prefixes():
if commit_message.lower().startswith(ignore_prefix):
continue

commit_hash = commit_message \
if unique_commit_messages \
else entry['commit_hash']
Expand Down

0 comments on commit e05b861

Please sign in to comment.