Skip to content

Commit

Permalink
Fix issue where copy would not correctly copy to clipboard (#8)
Browse files Browse the repository at this point in the history
* Fix issue where `copy` would not correctly copy to clipboard

This could occur when there were different types of changes in a release
that were separated by a new line.

* Fix comment typo
  • Loading branch information
atwalsh authored Jan 12, 2020
1 parent deb87e9 commit 39ab772
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Issue where `copy` would not correctly copy release text with new lines

## [0.2.0] - 2020-01-11
### Added
Expand Down
8 changes: 5 additions & 3 deletions kac/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ def copy_release_text(self, v: Union[LATEST, Tuple[int, int, int]] = LATEST) ->
:return: Nothing.
"""
version: Tuple[int, int, int] = self._get_most_recent_version() if v == self.LATEST else v
save_lines = False
save_lines = False # Whether or not we should be saving lines
text = ''
pattern = re.compile(self._version_title_re_pattern)
with open(self.changelog_file_path) as f:
for line in f:
for line in f: # Run through each line of the CHANGELOG
if save_lines:
if not line.strip():
# Stop saving release text if the line matches the release title regex pattern
if pattern.match(line):
save_lines = False
# Add the line to the release text we need to copy
else:
text += line
else:
Expand Down

0 comments on commit 39ab772

Please sign in to comment.