|
11 | 11 |
|
12 | 12 | from . import cli_logger
|
13 | 13 | from .. import exceptions
|
| 14 | +from . import cli_logger |
14 | 15 | from .utils import handle_collection_not_found
|
15 | 16 | from .utils import handle_collection_was_removed
|
16 | 17 | from .utils import handle_storage_init_error
|
@@ -144,6 +145,33 @@ async def collections_for_pair(
|
144 | 145 | "cache_key": cache_key,
|
145 | 146 | },
|
146 | 147 | )
|
| 148 | + |
| 149 | + if "from b" in (pair.collections or []): |
| 150 | + only_in_a = set(a_discovered.get_self().keys()) - set( |
| 151 | + b_discovered.get_self().keys() |
| 152 | + ) |
| 153 | + if only_in_a and "delete" in pair.config_a["implicit"]: |
| 154 | + for a in only_in_a: |
| 155 | + try: |
| 156 | + handle_collection_was_removed(pair.config_a, a) |
| 157 | + save_status(status_path, pair.name, a, data_type="metadata") |
| 158 | + save_status(status_path, pair.name, a, data_type="items") |
| 159 | + except NotImplementedError as e: |
| 160 | + cli_logger.error(e) |
| 161 | + |
| 162 | + if "from a" in (pair.collections or []): |
| 163 | + only_in_b = set(b_discovered.get_self().keys()) - set( |
| 164 | + a_discovered.get_self().keys() |
| 165 | + ) |
| 166 | + if only_in_b and "delete" in pair.config_b["implicit"]: |
| 167 | + for b in only_in_b: |
| 168 | + try: |
| 169 | + handle_collection_was_removed(pair.config_b, b) |
| 170 | + save_status(status_path, pair.name, b, data_type="metadata") |
| 171 | + save_status(status_path, pair.name, b, data_type="items") |
| 172 | + except NotImplementedError as e: |
| 173 | + cli_logger.error(e) |
| 174 | + |
147 | 175 | return rv
|
148 | 176 |
|
149 | 177 |
|
|
0 commit comments