Skip to content

Commit edf4ea9

Browse files
committed
Main branch exported first in apps export
1 parent baef09e commit edf4ea9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sonar/applications.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,18 +606,16 @@ def convert_app_json(old_app_json: dict[str, Any]) -> dict[str, Any]:
606606
new_json = common_json_helper.convert_common_fields(old_app_json.copy())
607607
if "branches" not in new_json:
608608
return new_json
609-
log.info("CONVERT %s", util.json_dump(new_json["branches"]))
610609
for br, data in new_json["branches"].items():
611-
log.info("CONVERT PROJS %s", util.json_dump(new_json["branches"][br].get("projects", {})))
612610
if "projects" not in data:
613611
continue
612+
new_json["branches"][br] = util.order_dict(data, ["name", "isMain", "projects"])
614613
new_json["branches"][br]["projects"] = util.dict_to_list(new_json["branches"][br]["projects"], "key", "branch")
615614
for proj_data in new_json["branches"][br]["projects"]:
616615
if proj_data.get("branch", None) in ("__default__", c.DEFAULT_BRANCH):
617616
proj_data.pop("branch")
618-
new_json["branches"] = util.dict_to_list(new_json["branches"], "name")
619-
log.info("RETURN %s", util.json_dump(new_json))
620-
return new_json
617+
new_json["branches"] = util.sort_list_by_key(util.dict_to_list(new_json["branches"], "name"), "name", "isMain")
618+
return util.order_dict(new_json, ["key", "name", "visibility", "tags", "branches", "permissions"])
621619

622620

623621
def convert_apps_json(old_json: dict[str, Any]) -> dict[str, Any]:

0 commit comments

Comments
 (0)