mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +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():
|
||||
if a == b:
|
||||
status[key] = a
|
||||
elif conflict_resolution is None:
|
||||
raise MetaSyncConflict(key=key)
|
||||
elif conflict_resolution == 'a wins':
|
||||
_a_to_b()
|
||||
elif conflict_resolution == 'b wins':
|
||||
_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:
|
||||
a = storage_a.get_meta(key)
|
||||
|
|
|
|||
Loading…
Reference in a new issue