Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/b4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _dkim_log_filter(record):
'thanks-pr-template': None,
# See thanks-am-template.example
'thanks-am-template': None,
# If this is not set, we'll use what we find in
# If this is not set, we'll use what we find in
# git-config for gpg.program, and if that's not set,
# we'll use "gpg" and hope for the better
'gpgbin': None,
Expand Down Expand Up @@ -2488,17 +2488,25 @@ def get_extra_prefixes(self, exclude: Optional[List[str]] = None) -> List[str]:

def get_rebuilt_subject(self, eprefixes: Optional[List[str]] = None) -> str:
_pfx = self.get_extra_prefixes()
version = ''
expected = ''
if eprefixes:
for _epfx in eprefixes:
if _epfx not in _pfx:
_pfx.append(_epfx)

if len(_pfx) > 0:
# This is added to handle the extra space after
# subject prefixes
_pfx.append('')

if self.revision > 1:
_pfx.append(f'v{self.revision}')
version = f' v{self.revision}'
if self.expected > 1:
_pfx.append('%s/%s' % (str(self.counter).zfill(len(str(self.expected))), self.expected))
expected = ' %s/%s' % (str(self.counter).zfill(len(str(self.expected))), self.expected)

if len(_pfx):
return '[PATCH ' + ' '.join(_pfx) + '] ' + self.subject
if len(_pfx) or len(version) or len(expected):
return '[' + ' '.join(_pfx) + 'PATCH' + version + expected + '] ' + self.subject
else:
return f'[PATCH] {self.subject}'

Expand Down