mirror of https://github.com/yt-dlp/yt-dlp.git
[devscripts/make_changelog] Skip reverted commits
This commit is contained in:
parent
47bcd43724
commit
fa44802809
|
@ -252,6 +252,7 @@ class CommitRange:
|
||||||
(?:\ \((?P<issues>\#\d+(?:,\ \#\d+)*)\))?
|
(?:\ \((?P<issues>\#\d+(?:,\ \#\d+)*)\))?
|
||||||
''', re.VERBOSE | re.DOTALL)
|
''', re.VERBOSE | re.DOTALL)
|
||||||
EXTRACTOR_INDICATOR_RE = re.compile(r'(?:Fix|Add)\s+Extractors?', re.IGNORECASE)
|
EXTRACTOR_INDICATOR_RE = re.compile(r'(?:Fix|Add)\s+Extractors?', re.IGNORECASE)
|
||||||
|
REVERT_RE = re.compile(r'(?i:Revert)\s+([\da-f]{40})')
|
||||||
FIXES_RE = re.compile(r'(?i:Fix(?:es)?(?:\s+bugs?)?(?:\s+in|\s+for)?|Revert)\s+([\da-f]{40})')
|
FIXES_RE = re.compile(r'(?i:Fix(?:es)?(?:\s+bugs?)?(?:\s+in|\s+for)?|Revert)\s+([\da-f]{40})')
|
||||||
UPSTREAM_MERGE_RE = re.compile(r'Update to ytdl-commit-([\da-f]+)')
|
UPSTREAM_MERGE_RE = re.compile(r'Update to ytdl-commit-([\da-f]+)')
|
||||||
|
|
||||||
|
@ -279,7 +280,7 @@ class CommitRange:
|
||||||
self.COMMAND, 'log', f'--format=%H%n%s%n%b%n{self.COMMIT_SEPARATOR}',
|
self.COMMAND, 'log', f'--format=%H%n%s%n%b%n{self.COMMIT_SEPARATOR}',
|
||||||
f'{self._start}..{self._end}' if self._start else self._end).stdout
|
f'{self._start}..{self._end}' if self._start else self._end).stdout
|
||||||
|
|
||||||
commits = {}
|
commits, reverts = {}, {}
|
||||||
fixes = defaultdict(list)
|
fixes = defaultdict(list)
|
||||||
lines = iter(result.splitlines(False))
|
lines = iter(result.splitlines(False))
|
||||||
for i, commit_hash in enumerate(lines):
|
for i, commit_hash in enumerate(lines):
|
||||||
|
@ -300,6 +301,11 @@ class CommitRange:
|
||||||
logger.debug(f'Reached Release commit, breaking: {commit}')
|
logger.debug(f'Reached Release commit, breaking: {commit}')
|
||||||
break
|
break
|
||||||
|
|
||||||
|
revert_match = self.REVERT_RE.fullmatch(commit.short)
|
||||||
|
if revert_match:
|
||||||
|
reverts[revert_match.group(1)] = commit
|
||||||
|
continue
|
||||||
|
|
||||||
fix_match = self.FIXES_RE.search(commit.short)
|
fix_match = self.FIXES_RE.search(commit.short)
|
||||||
if fix_match:
|
if fix_match:
|
||||||
commitish = fix_match.group(1)
|
commitish = fix_match.group(1)
|
||||||
|
@ -307,6 +313,13 @@ class CommitRange:
|
||||||
|
|
||||||
commits[commit.hash] = commit
|
commits[commit.hash] = commit
|
||||||
|
|
||||||
|
for commitish, revert_commit in reverts.items():
|
||||||
|
reverted = commits.pop(commitish, None)
|
||||||
|
if reverted:
|
||||||
|
logger.debug(f'{commit} fully reverted {reverted}')
|
||||||
|
else:
|
||||||
|
commits[revert_commit.hash] = revert_commit
|
||||||
|
|
||||||
for commitish, fix_commits in fixes.items():
|
for commitish, fix_commits in fixes.items():
|
||||||
if commitish in commits:
|
if commitish in commits:
|
||||||
hashes = ', '.join(commit.hash[:HASH_LENGTH] for commit in fix_commits)
|
hashes = ', '.join(commit.hash[:HASH_LENGTH] for commit in fix_commits)
|
||||||
|
|
Loading…
Reference in New Issue