Skip to content

Commit 6e29cdb

Browse files
committed
Simplify manifest class
1 parent 405a891 commit 6e29cdb

7 files changed

Lines changed: 376 additions & 164 deletions

File tree

dfetch/commands/add.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def _finalize_add(
253253
return
254254

255255
superproject.manifest.append_project_entry(project_entry)
256-
superproject.manifest.update_dump()
256+
superproject.manifest.dump()
257257
logger.print_info_line(
258258
project_entry.name,
259259
f"Added '{project_entry.name}' to manifest '{superproject.manifest.path}'",

dfetch/commands/freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,5 @@ def __call__(self, args: argparse.Namespace) -> None:
135135
manifest_updated = True
136136

137137
if manifest_updated:
138-
superproject.manifest.update_dump()
138+
superproject.manifest.dump()
139139
logger.info(f"Updated manifest ({manifest_path}) in {os.getcwd()}")

dfetch/commands/import_.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,19 @@ def __call__(self, _: argparse.Namespace) -> None:
5858
project.set_remote(remote)
5959
break
6060

61+
single_remote = len(remotes) == 1
62+
project_dicts = []
63+
for p in projects:
64+
d = p.as_yaml()
65+
if single_remote:
66+
d.pop("remote", None)
67+
project_dicts.append(d)
68+
6169
manifest_data = {
6270
"manifest": {
6371
"version": "0.0",
6472
"remotes": [r.as_yaml() for r in remotes],
65-
"projects": [p.as_yaml() for p in projects],
73+
"projects": project_dicts,
6674
}
6775
}
6876
manifest = Manifest.from_yaml(yaml.dump(manifest_data, sort_keys=False))

0 commit comments

Comments
 (0)