Skip to content

Commit 528e551

Browse files
(PTFE-2504) Develop branch with three digit (#251)
1 parent 43d0307 commit 528e551

5 files changed

Lines changed: 693 additions & 166 deletions

File tree

bert_e/exceptions.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,17 @@ def __init__(self, name):
290290
super(BranchNameInvalid, self).__init__(msg)
291291

292292

293+
class ReleaseAlreadyExists(InternalException):
294+
code = 204
295+
296+
def __init__(self, branch, tag):
297+
msg = 'Branch %r must be deleted as %r has been created, ' \
298+
'you must use a hotfix branch if you really intend ' \
299+
'to target this version.' \
300+
% (branch, tag)
301+
super(ReleaseAlreadyExists, self).__init__(msg)
302+
303+
293304
class UnrecognizedBranchPattern(InternalException):
294305
code = 207
295306

@@ -435,10 +446,21 @@ class MasterQueueMissing(QueueValidationError):
435446
code = 'Q001'
436447
auto_recovery = False
437448

449+
@staticmethod
450+
def _format_version(version):
451+
if not version:
452+
return '[]'
453+
if len(version) == 1 or (len(version) > 1 and version[1] is None):
454+
return f"{version[0]}"
455+
if len(version) == 2 or (len(version) > 2 and version[2] is None):
456+
return f"{version[0]}.{version[1]}"
457+
return f"{version[0]}.{version[1]}.{version[2]}"
458+
438459
def __init__(self, version):
439-
msg = 'there are integration queues on this version ' \
440-
'but q/%s.%s is missing' % version
441-
super(MasterQueueMissing, self).__init__(msg)
460+
version_str = self._format_version(version)
461+
msg = "there are integration queues on " \
462+
f"this version but q/{version_str} is missing"
463+
super().__init__(msg)
442464

443465

444466
class MasterQueueLateVsDev(QueueValidationError):

0 commit comments

Comments
 (0)