mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
metasync: Error on invalid conflict resolution
This commit is contained in:
parent
471882fc5e
commit
1c030d40ac
1 changed files with 8 additions and 2 deletions
|
|
@ -28,12 +28,18 @@ def metasync(storage_a, storage_b, status, keys, conflict_resolution=None):
|
||||||
def _resolve_conflict():
|
def _resolve_conflict():
|
||||||
if a == b:
|
if a == b:
|
||||||
status[key] = a
|
status[key] = a
|
||||||
elif conflict_resolution is None:
|
|
||||||
raise MetaSyncConflict(key=key)
|
|
||||||
elif conflict_resolution == 'a wins':
|
elif conflict_resolution == 'a wins':
|
||||||
_a_to_b()
|
_a_to_b()
|
||||||
elif conflict_resolution == 'b wins':
|
elif conflict_resolution == 'b wins':
|
||||||
_b_to_a()
|
_b_to_a()
|
||||||
|
else:
|
||||||
|
if callable(conflict_resolution):
|
||||||
|
logger.warning('Custom commands don\'t work on metasync.')
|
||||||
|
elif conflict_resolution is not None:
|
||||||
|
raise exceptions.UserError(
|
||||||
|
'Invalid conflict resolution setting.'
|
||||||
|
)
|
||||||
|
raise MetaSyncConflict(key)
|
||||||
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
a = storage_a.get_meta(key)
|
a = storage_a.get_meta(key)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue