refactor: move unlock/lock/kick to porcelain

This commit is contained in:
Swann 2021-06-02 11:31:23 +02:00
parent 431fe0d840
commit c9665c4719
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
3 changed files with 35 additions and 33 deletions

@ -1 +1 @@
Subproject commit 15d80abe6ddd28fefb896127a01c12777a22a4e1
Subproject commit baa55ea8c410af037724c99184d54b45724df69b

View File

@ -221,7 +221,12 @@ class SessionStartOperator(bpy.types.Operator):
for scene in bpy.data.scenes:
porcelain.add(repo, scene)
porcelain.remote_add(repo, 'origin','127.0.0.1', settings.port)
porcelain.remote_add(
repo,
'origin',
'127.0.0.1',
settings.port,
admin_password=admin_pass)
session.host(
repository= repo,
remote='origin',
@ -243,7 +248,12 @@ class SessionStartOperator(bpy.types.Operator):
admin_pass = None
try:
porcelain.remote_add(repo, 'origin', settings.ip, settings.port)
porcelain.remote_add(
repo,
'origin',
settings.ip,
settings.port,
admin_password=admin_pass)
session.connect(
repository= repo,
timeout=settings.connection_timeout,
@ -257,10 +267,7 @@ class SessionStartOperator(bpy.types.Operator):
deleyables.append(timers.ClientUpdate())
deleyables.append(timers.DynamicRightSelectTimer())
deleyables.append(timers.ApplyTimer(timeout=settings.depsgraph_update_rate))
# deleyables.append(timers.PushTimer(
# queue=stagging,
# timeout=settings.depsgraph_update_rate
# ))
session_update = timers.SessionStatusUpdate()
session_user_sync = timers.SessionUserSync()
session_background_executor = timers.MainThreadExecutor(
@ -365,7 +372,7 @@ class SessionKickOperator(bpy.types.Operator):
assert(session)
try:
session.kick(self.user)
porcelain.kick(session.repository, self.user)
except Exception as e:
self.report({'ERROR'}, repr(e))

View File

@ -161,9 +161,8 @@ class DynamicRightSelectTimer(Timer):
self._annotating = True
logging.debug(
"Getting the right on the annotation GP")
session.change_owner(
porcelain.lock(session.repository,
registered_gp.uuid,
settings.username,
ignore_warnings=True,
affect_dependencies=False)
@ -173,9 +172,8 @@ class DynamicRightSelectTimer(Timer):
porcelain.push(session.repository, 'origin', gp_node.uuid)
elif self._annotating:
session.change_owner(
porcelain.unlock(session.repository,
registered_gp.uuid,
RP_COMMON,
ignore_warnings=True,
affect_dependencies=False)
@ -198,9 +196,8 @@ class DynamicRightSelectTimer(Timer):
if node.data and 'instance_type' in node.data.keys():
recursive = node.data['instance_type'] != 'COLLECTION'
try:
session.change_owner(
porcelain.unlock(session.repository,
node.uuid,
RP_COMMON,
ignore_warnings=True,
affect_dependencies=recursive)
except NonAuthorizedOperationError:
@ -217,9 +214,8 @@ class DynamicRightSelectTimer(Timer):
recursive = node.data['instance_type'] != 'COLLECTION'
try:
session.change_owner(
porcelain.lock(session.repository,
node.uuid,
settings.username,
ignore_warnings=True,
affect_dependencies=recursive)
except NonAuthorizedOperationError:
@ -244,9 +240,8 @@ class DynamicRightSelectTimer(Timer):
for key in owned_keys:
node = session.repository.get_node(key)
try:
session.change_owner(
porcelain.unlock(session.repository,
key,
RP_COMMON,
ignore_warnings=True,
affect_dependencies=recursive)
except NonAuthorizedOperationError: