|
6 | 6 |
|
7 | 7 | # pylint: disable=no-else-return |
8 | 8 |
|
9 | | -import json |
10 | | -import os |
11 | 9 | import time |
12 | 10 |
|
13 | | -from deepdiff import DeepDiff |
14 | 11 | from knack.log import get_logger |
15 | | - |
| 12 | +import azure_cli_diff_tool |
16 | 13 | from azdev.utilities import display, require_azure_cli, heading, get_path_table, filter_by_git_diff |
17 | | -from .custom import MetaChangeDetects, DiffExportFormat |
18 | | -from .util import export_meta_changes_to_json, gen_commands_meta, get_commands_meta |
| 14 | +from .custom import DiffExportFormat, get_commands_meta |
| 15 | +from .util import export_commands_meta |
19 | 16 | from ..statistics import _create_invoker_and_load_cmds, _get_command_source, \ |
20 | 17 | _command_codegen_info # pylint: disable=protected-access |
21 | 18 | from ..statistics.util import filter_modules |
22 | 19 |
|
| 20 | + |
23 | 21 | logger = get_logger(__name__) |
24 | 22 |
|
25 | 23 |
|
@@ -117,28 +115,9 @@ def export_command_meta(modules=None, git_source=None, git_target=None, git_repo |
117 | 115 |
|
118 | 116 | commands_info.append(command_info) |
119 | 117 | commands_meta = get_commands_meta(command_loader.command_group_table, commands_info, with_help, with_example) |
120 | | - gen_commands_meta(commands_meta, meta_output_path) |
| 118 | + export_commands_meta(commands_meta, meta_output_path) |
121 | 119 | display(f"Total Commands: {len(commands_info)} from {', '.join(selected_mod_names)} have been generated.") |
122 | 120 |
|
123 | 121 |
|
124 | 122 | def cmp_command_meta(base_meta_file, diff_meta_file, only_break=False, output_type="text", output_file=None): |
125 | | - if not os.path.exists(base_meta_file): |
126 | | - raise Exception("base meta file needed") |
127 | | - if not os.path.exists(diff_meta_file): |
128 | | - raise Exception("diff meta file needed") |
129 | | - start = time.time() |
130 | | - with open(base_meta_file, "r") as g: |
131 | | - command_tree_before = json.load(g) |
132 | | - with open(diff_meta_file, "r") as g: |
133 | | - command_tree_after = json.load(g) |
134 | | - stop = time.time() |
135 | | - logger.info('Command meta files loaded in %i sec', stop - start) |
136 | | - diff = DeepDiff(command_tree_before, command_tree_after) |
137 | | - if not diff: |
138 | | - display(f"No meta diffs from {diff_meta_file} to {base_meta_file}") |
139 | | - return export_meta_changes_to_json(None, output_file) |
140 | | - else: |
141 | | - detected_changes = MetaChangeDetects(diff, command_tree_before, command_tree_after) |
142 | | - detected_changes.check_deep_diffs() |
143 | | - result = detected_changes.export_meta_changes(only_break, output_type) |
144 | | - return export_meta_changes_to_json(result, output_file) |
| 123 | + return azure_cli_diff_tool.meta_diff(base_meta_file, diff_meta_file, only_break, output_type, output_file) |
0 commit comments