[devscripts] make_changelog: Stop at Release ... commit

Closes #6415
This commit is contained in:
pukkandan 2023-03-04 16:39:23 +05:30
parent 283a0b5bc5
commit 7accdd9845
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
3 changed files with 10 additions and 32 deletions

View File

@ -4,7 +4,7 @@ on:
branches:
- master
paths:
- "**.py"
- "yt_dlp/**.py"
- "!yt_dlp/version.py"
concurrency:
group: release-nightly

View File

@ -1,12 +1,12 @@
[
{
"action": "add",
"when": "2023.02.17",
"when": "776d1c3f0c9b00399896dd2e40e78e9a43218109",
"short": "[priority] **A new release type has been added!**\n * [`nightly`](https://github.com/yt-dlp/yt-dlp/releases/tag/nightly) builds will be made after each push, containing the latest fixes (but also possibly bugs).\n * When using `--update`/`-U`, a release binary will only update to its current channel (either `stable` or `nightly`).\n * The `--update-to` option has been added allowing the user more control over program upgrades (or downgrades).\n * `--update-to` can change the release channel (`stable`, `nightly`) and also upgrade or downgrade to specific tags.\n * **Usage**: `--update-to CHANNEL`, `--update-to TAG`, `--update-to CHANNEL@TAG`"
},
{
"action": "add",
"when": "2023.02.17",
"when": "776d1c3f0c9b00399896dd2e40e78e9a43218109",
"short": "[priority] **YouTube throttling fixes!**"
}
]

View File

@ -248,30 +248,6 @@ class CommitRange:
self._commits, self._fixes = self._get_commits_and_fixes(default_author)
self._commits_added = []
@classmethod
def from_single(cls, commitish='HEAD', default_author=None):
start_commitish = cls.get_prev_tag(commitish)
end_commitish = cls.get_next_tag(commitish)
if start_commitish == end_commitish:
start_commitish = cls.get_prev_tag(f'{commitish}~')
logger.info(f'Determined range from {commitish!r}: {start_commitish}..{end_commitish}')
return cls(start_commitish, end_commitish, default_author)
@classmethod
def get_prev_tag(cls, commitish):
command = [cls.COMMAND, 'describe', '--tags', '--abbrev=0', '--exclude=*[^0-9.]*', commitish]
return subprocess.check_output(command, text=True).strip()
@classmethod
def get_next_tag(cls, commitish):
result = subprocess.run(
[cls.COMMAND, 'describe', '--contains', '--abbrev=0', commitish],
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)
if result.returncode:
return 'HEAD'
return result.stdout.partition('~')[0].strip()
def __iter__(self):
return iter(itertools.chain(self._commits.values(), self._commits_added))
@ -293,13 +269,12 @@ class CommitRange:
def _get_commits_and_fixes(self, default_author):
result = subprocess.check_output([
self.COMMAND, 'log', f'--format=%H%n%s%n%b%n{self.COMMIT_SEPARATOR}',
f'{self._start}..{self._end}'], text=True)
f'{self._start}..{self._end}' if self._start else self._end], text=True)
commits = {}
fixes = defaultdict(list)
lines = iter(result.splitlines(False))
for line in lines:
commit_hash = line
for i, commit_hash in enumerate(lines):
short = next(lines)
skip = short.startswith('Release ') or short == '[version] update'
@ -310,9 +285,12 @@ class CommitRange:
authors = sorted(map(str.strip, line[match.end():].split(',')), key=str.casefold)
commit = Commit(commit_hash, short, authors)
if skip:
if skip and (self._start or not i):
logger.debug(f'Skipped commit: {commit}')
continue
elif skip:
logger.debug(f'Reached Release commit, breaking: {commit}')
break
fix_match = self.FIXES_RE.search(commit.short)
if fix_match:
@ -471,7 +449,7 @@ if __name__ == '__main__':
datefmt='%Y-%m-%d %H-%M-%S', format='{asctime} | {levelname:<8} | {message}',
level=logging.WARNING - 10 * args.verbosity, style='{', stream=sys.stderr)
commits = CommitRange.from_single(args.commitish, args.default_author)
commits = CommitRange(None, args.commitish, args.default_author)
if not args.no_override:
if args.override_path.exists():