this function will get the apis that difference between API_DEV.spec and API_PR.spec.
(
api_dev_spec_fn: str | None = None,
api_pr_spec_fn: str | None = None,
api_diff_spec_fn: str | None = None,
)
| 356 | |
| 357 | |
| 358 | def get_incrementapi( |
| 359 | api_dev_spec_fn: str | None = None, |
| 360 | api_pr_spec_fn: str | None = None, |
| 361 | api_diff_spec_fn: str | None = None, |
| 362 | ) -> None: |
| 363 | ''' |
| 364 | this function will get the apis that difference between API_DEV.spec and API_PR.spec. |
| 365 | ''' |
| 366 | global API_DEV_SPEC_FN, API_PR_SPEC_FN, API_DIFF_SPEC_FN # readonly |
| 367 | |
| 368 | dev_api = get_api_md5( |
| 369 | API_DEV_SPEC_FN if api_dev_spec_fn is None else api_dev_spec_fn |
| 370 | ) |
| 371 | pr_api = get_api_md5( |
| 372 | API_PR_SPEC_FN if api_pr_spec_fn is None else api_pr_spec_fn |
| 373 | ) |
| 374 | with open( |
| 375 | API_DIFF_SPEC_FN if api_diff_spec_fn is None else api_diff_spec_fn, 'w' |
| 376 | ) as f: |
| 377 | for key in pr_api: |
| 378 | if key in dev_api: |
| 379 | if dev_api[key] != pr_api[key]: |
| 380 | logger.debug( |
| 381 | "%s in dev is %s, different from pr's %s", |
| 382 | key, |
| 383 | dev_api[key], |
| 384 | pr_api[key], |
| 385 | ) |
| 386 | f.write(key) |
| 387 | f.write('\n') |
| 388 | else: |
| 389 | logger.debug("%s is not in dev", key) |
| 390 | f.write(key) |
| 391 | f.write('\n') |
| 392 | |
| 393 | |
| 394 | def get_full_api_by_walk(): |