Skip to content

Commit 99fc13e

Browse files
committed
fix(changelog): sort the commits properly to their version
1 parent 07c1a16 commit 99fc13e

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

CHANGELOG.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11

2+
## Unreleased
23

4+
### Fix
35

6+
- **changelog**: sort the commits properly to their version
47

5-
## v1.19.1
8+
## v1.19.1 (2020-05-03)
69

710
### Fix
811

@@ -12,7 +15,7 @@
1215

1316
- **cli**: add explicit category for deprecation warnings
1417

15-
## v1.19.0
18+
## v1.19.0 (2020-05-02)
1619

1720
### Fix
1821

@@ -24,11 +27,6 @@
2427
- **changelog**: add support for any commit rule system
2528
- **changelog**: add incremental flag
2629

27-
### Refactor
28-
29-
- **changelog**: use functions from changelog.py
30-
- **changelog**: rename category to change_type to fit 'keep a changelog'
31-
3230
## v1.18.3 (2020-04-22)
3331

3432
### Refactor
@@ -40,6 +38,8 @@
4038
### Refactor
4139

4240
- **git**: replace GitCommit.message code with one-liner
41+
- **changelog**: use functions from changelog.py
42+
- **changelog**: rename category to change_type to fit 'keep a changelog'
4343
- **templates**: rename as "keep_a_changelog_template.j2"
4444
- **templates**: remove unneeded __init__ file
4545
- **cli**: reorder commands
@@ -175,20 +175,20 @@
175175
### Refactor
176176

177177
- **tests/commands/bump**: use tmp_dir to replace self implemented tmp dir behavior
178+
- **git**: make find_git_project_root return None if it's not a git project
179+
- **config/base_config**: make set_key not implemented
180+
- **error_codes**: move all the error_codes to a module
181+
- **config**: replace string type path with pathlib.Path
178182
- **test_bump_command**: rename camel case variables
179183
- **tests/commands/check**: use pytest fixture tmpdir replace self implemented contextmanager
180184
- **test/commands/other**: replace unit test style mock with mocker fixture
181185
- **tests/commands**: separate command unit tests into modules
182186
- **tests/commands**: make commands related tests a module
183-
- **git**: make find_git_project_root return None if it's not a git project
184-
- **config/base_config**: make set_key not implemented
185-
- **error_codes**: move all the error_codes to a module
186-
- **config**: replace string type path with pathlib.Path
187187

188188
### Fix
189189

190-
- **cli**: fix --version not functional
191190
- **git**: remove breakline in the return value of find_git_project_root
191+
- **cli**: fix --version not functional
192192

193193
### Feat
194194

@@ -298,10 +298,10 @@
298298
- **config**: add deprecation warning for loading config from ini files
299299
- **cz/customize**: add jinja support to enhance template flexibility
300300
- **cz/filters**: add required_validator and multiple_line_breaker
301-
- **Commands/commit**: add ´--dry-run´ flag to the Commit command
302301
- **cz/cz_customize**: implement info to support info and info_path
303302
- **cz/cz_customize**: enable bump_pattern bump_map customization
304303
- **cz/cz_customize**: implement customizable cz
304+
- **Commands/commit**: add ´--dry-run´ flag to the Commit command
305305
- new 'git-cz' entrypoint
306306

307307
### Refactor
@@ -512,10 +512,6 @@
512512

513513
## v0.9.2 (2017-11-11)
514514

515-
### Refactor
516-
517-
- **renamed conventional_changelog to conventional_commits, not backward compatible**:
518-
519515
## v0.9.1 (2017-11-11)
520516

521517
### Fix

commitizen/commands/changelog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __call__(self):
7777
if latest_version:
7878
start_rev = self._find_incremental_rev(latest_version, tags)
7979

80-
commits = git.get_commits(start=start_rev)
80+
commits = git.get_commits(start=start_rev, args="--author-date-order")
8181
if not commits:
8282
out.error("No commits found")
8383
raise SystemExit(NO_COMMITS_FOUND)

commitizen/git.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def tag(tag: str):
4646
return c
4747

4848

49-
def commit(message: str, args=""):
49+
def commit(message: str, args: str = ""):
5050
f = NamedTemporaryFile("wb", delete=False)
5151
f.write(message.encode("utf-8"))
5252
f.close()
@@ -61,11 +61,12 @@ def get_commits(
6161
*,
6262
log_format: str = "%H%n%s%n%b",
6363
delimiter: str = "----------commit-delimiter----------",
64+
args: str = "",
6465
) -> List[GitCommit]:
6566
"""
6667
Get the commits betweeen start and end
6768
"""
68-
git_log_cmd = f"git log --pretty={log_format}{delimiter}"
69+
git_log_cmd = f"git log --pretty={log_format}{delimiter} {args}"
6970

7071
if start:
7172
c = cmd.run(f"{git_log_cmd} {start}..{end}")

0 commit comments

Comments
 (0)