Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for documents in separate projects, status filters and text work items #106

Merged
merged 14 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions capella2polarion/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,10 @@ def render_documents(
overwrite_layouts,
)

new_documents, updated_documents, work_items = renderer.render_documents(
configs, documents
)

polarion_worker.post_documents(new_documents)
polarion_worker.update_documents(updated_documents)
polarion_worker.update_work_items(work_items)
projects_document_data = renderer.render_documents(configs, documents)
for project, project_data in projects_document_data.items():
polarion_worker.create_documents(project_data.new_docs, project)
polarion_worker.update_documents(project_data.updated_docs, project)


if __name__ == "__main__":
Expand Down
13 changes: 13 additions & 0 deletions capella2polarion/connectors/polarion_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import collections.abc as cabc

import bidict
import polarion_rest_api_client as polarion_api

from capella2polarion import data_models

Expand Down Expand Up @@ -114,3 +115,15 @@ def remove_work_items_by_capella_uuid(self, uuids: cabc.Iterable[str]):
for uuid in uuids:
del self._work_items[uuid]
del self._id_mapping[uuid]


DocumentRepository = dict[
tuple[str | None, str, str],
tuple[polarion_api.Document | None, list[polarion_api.WorkItem]],
]
"""A dict providing a mapping for documents and their text workitems.

It has (project, space, name) of the document as key and (document,
workitems) as value. The project can be None and the None value means
that the document is in the same project as the model sync work items.
"""
Loading
Loading