MCPcopy
hub / github.com/pimutils/vdirsyncer / sync_collection

Function sync_collection

vdirsyncer/cli/tasks.py:43–76  ·  view source on GitHub ↗
(wq, collection, general, force_delete)

Source from the content-addressed store, hash-verified

41
42
43def sync_collection(wq, collection, general, force_delete):
44 pair = collection.pair
45 status_name = get_status_name(pair.name, collection.name)
46
47 try:
48 cli_logger.info('Syncing {}'.format(status_name))
49
50 a = storage_instance_from_config(collection.config_a)
51 b = storage_instance_from_config(collection.config_b)
52
53 sync_failed = False
54
55 def error_callback(e):
56 nonlocal sync_failed
57 sync_failed = True
58 handle_cli_error(status_name, e)
59
60 with manage_sync_status(general['status_path'], pair.name,
61 collection.name) as status:
62 sync.sync(
63 a, b, status,
64 conflict_resolution=pair.conflict_resolution,
65 force_delete=force_delete,
66 error_callback=error_callback,
67 partial_sync=pair.partial_sync
68 )
69
70 if sync_failed:
71 raise JobFailed()
72 except JobFailed:
73 raise
74 except BaseException:
75 handle_cli_error(status_name)
76 raise JobFailed()
77
78
79def discover_collections(wq, pair, **kwargs):

Callers

nothing calls this directly

Calls 6

get_status_nameFunction · 0.85
manage_sync_statusFunction · 0.85
JobFailedClass · 0.85
handle_cli_errorFunction · 0.85
syncMethod · 0.80

Tested by

no test coverage detected