Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Prototyp Videoag Website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Dorian Koch
Prototyp Videoag Website
Commits
80f1bdd9
Commit
80f1bdd9
authored
1 year ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
py: fix some changelog variable names and documentation
parent
1136a5c6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/objects/changelog.py
+6
-7
6 additions, 7 deletions
src/api/objects/changelog.py
src/api/objects/changelog_v1.py
+8
-8
8 additions, 8 deletions
src/api/objects/changelog_v1.py
src/api/objects/current_changelog.py
+5
-5
5 additions, 5 deletions
src/api/objects/current_changelog.py
with
19 additions
and
20 deletions
src/api/objects/changelog.py
+
6
−
7
View file @
80f1bdd9
...
...
@@ -36,7 +36,7 @@ EntryTypeGeneric = TypeVar("EntryTypeGeneric", bound=ChangelogEntry)
# noinspection PyUnresolvedReferences
class
ChangelogEntrySubject
(
Generic
[
EntryTypeGeneric
],
ABC
):
"""
The subject for a :class:`ChangelogEntry`. A
n
subject is bound to a specific object class and represents
'
something
'
The subject for a :class:`ChangelogEntry`. A subject is bound to a specific object class and represents
'
something
'
that can be
'
modified
'
.
For example, ObjectField is an entry subject since it represents a single value which can be modified. All such
entries are of type ModificationEntry.
...
...
@@ -226,12 +226,6 @@ class ChangelogVersionManager:
class
ChangelogVersionBuilder
:
"""
Used to build a :class:`ChangelogVersionManager`
Versions are build in reverse! That is, you start with start_major_version(3) and add mappings for that version.
Then you start_minor_version(2) and apply all differences this version has to the next version (v3) (When you start
a minor version, all mappings of the next version (the previous build version) are still there). Then
start_minor_version(1), etc. For the next major version, you do start_major_version(6), then start_minor_version(5),
etc.
"""
def
__init__
(
self
):
...
...
@@ -283,6 +277,11 @@ class ChangelogVersionBuilder:
self
.
_current_subject_id_by_subject
=
{}
def
start_version
(
self
,
id
:
int
,
depends_on
:
int
or
None
=
None
):
"""
:param id: ID for this version. Must not be negative
:param depends_on: ID of an already finished version on which this version depends. All entries from that
version are copied for the new version, and changes can then be made.
"""
if
self
.
_current_version
!=
-
1
:
raise
RuntimeError
(
"
Already building a version. Finish previous version with finish_version()
"
)
if
id
<
0
:
...
...
This diff is collapsed.
Click to expand it.
src/api/objects/changelog_v1.py
+
8
−
8
View file @
80f1bdd9
...
...
@@ -120,14 +120,14 @@ class _LegacyModificationEntryCodec(ChangelogEntryCodec[ObjectField]):
def
decode_entry
(
self
,
subject
:
ObjectField
,
object_id
:
int
,
param
2
:
str
or
None
,
# old value
param
3
:
str
)
->
ModificationEntry
:
# new value
param
1
:
str
or
None
,
# old value
param
2
:
str
)
->
ModificationEntry
:
# new value
return
ModificationEntry
(
subject
,
object_id
,
None
if
param
2
is
None
else
self
.
_decoder
(
param
2
),
self
.
_decoder
(
param
3
),
param
2
is
None
# It's likely at creation if old value is None, but we can't be sure
None
if
param
1
is
None
else
self
.
_decoder
(
param
1
),
self
.
_decoder
(
param
2
),
param
1
is
None
# It's likely at creation if old value is None, but we can't be sure
)
def
supports_encoding
(
self
)
->
bool
:
...
...
@@ -144,12 +144,12 @@ class _DeletionEntryCodec(ChangelogEntryCodec[SimpleChangelogEntrySubject]):
def
decode_entry
(
self
,
subject
:
SimpleChangelogEntrySubject
,
object_id
:
int
,
param
2
:
str
or
None
,
param
3
:
str
)
->
DeletionEntry
:
param
1
:
str
or
None
,
param
2
:
str
)
->
DeletionEntry
:
return
DeletionEntry
(
subject
,
object_id
,
_decode_legacy_boolean
(
param
3
)
_decode_legacy_boolean
(
param
2
)
)
def
supports_encoding
(
self
)
->
bool
:
...
...
This diff is collapsed.
Click to expand it.
src/api/objects/current_changelog.py
+
5
−
5
View file @
80f1bdd9
...
...
@@ -131,22 +131,22 @@ class ChangelogUpdate:
try
:
if
not
_VERSION_MANAGER
.
can_encode_for
(
entry
.
subject
,
version
):
raise
ChangelogEntryError
()
param1
,
param2
,
param3
=
_VERSION_MANAGER
.
encode_entry
(
version
,
entry
)
object_id
,
param1
,
param2
=
_VERSION_MANAGER
.
encode_entry
(
version
,
entry
)
except
ChangelogEntryError
:
version
=
_VERSION_MANAGER
.
get_current_version_id
()
if
not
_VERSION_MANAGER
.
can_encode_for
(
entry
.
subject
,
version
):
raise
RuntimeError
(
"
Cannot encode entry for current version
"
)
param1
,
param2
,
param3
=
_VERSION_MANAGER
.
encode_entry
(
version
,
entry
)
object_id
,
param1
,
param2
=
_VERSION_MANAGER
.
encode_entry
(
version
,
entry
)
id
=
_VERSION_MANAGER
.
get_subject_id
(
entry
.
subject
,
version
)
table
,
field
=
id
log_list
.
append
((
version
,
table
,
param1
,
object_id
,
field
,
param
2
,
param
3
param
1
,
param
2
))
transaction
.
queue_statement
(
f
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment