Main Content

padv.util.mergeArtifactDatabases

Merge artifact database files

Since R2023b

    Description

    padv.util.mergeArtifactDatabases(Base = baseFile, Branches = filesToMerge, Merged = mergedFile) merges the artifact database files, filesToMerge, with the common ancestor artifact database file, baseFile, to create a merged artifact database file mergedFile.

    You can use this function to merge artifact database files from different feature branches or CI pipeline jobs. The function requires an open project.

    This functionality requires CI/CD Automation for Simulink Check.

    example

    padv.util.mergeArtifactDatabases(___,CheckOutdatedResults = false) merges without validating that task results are still up-to-date after the merge. Outdated results are not expected if the merge is successful. When there are outdated results, there could be an issue with the merge. By default, CheckOutdatedResults is true.

    Note

    Only supported in R2023b Update 5 and later releases.

    Examples

    collapse all

    Process Advisor and the build system are able to detect changes to project files and identify outdated tasks by using the information in the artifact database file artifacts.dmr. When your team works on a project with multiple feature branches, you might need to merge different versions of artifacts.dmr into a single file that contains the latest project analysis. To create the file, you need to save a copy of the base artifact database file and then merge the artifacts.dmr files from each branch.

    When your team members clone the project from source control, have them download the latest derived files, including the artifacts.dmr file that contains the latest analysis of the project. By default, digital thread stores the artifact database file inside the derived folder in the project root.

    You can use a database or repository management tool to handle derived files effectively.

    To resolve conflicts between the artifact database files from the different feature branches, you need to create a base artifact database file. Use the most recent artifacts.dmr file from the derived files as the base because that file represents the latest shared state of project analysis across the feature branches.

    Create a copy of the artifact database file inside the derived folder and name the file base.dmr.

    padv.util.saveArtifactDatabase(fullfile("derived","base.dmr"))

    As each team member works on their separate branches, the digital thread updates the artifacts.dmr file in their copy of the project to reflect their changes.

    After a team member makes the changes on their branch, use the function padv.util.saveArtifactDatabase in each branch to save a copy of the artifact database file from that branch. For example, you might have artifact database files like featureA.dmr and featureB.dmr.

    Merge the artifact database files into a new artifacts.dmr file by using the function padv.util.mergeArtifactDatabases. The base artifact database file is base.dmr and the artifact database files from the branches are featureA.dmr and featureB.dmr.

    padv.util.mergeArtifactDatabases(...
    Base = fullfile("derived","base.dmr"),...
    Branches = [fullfile("derived","featureA.dmr"), fullfile("derived","featureB.dmr")],...
    Merged = fullfile("derived","artifacts.dmr"))

    Input Arguments

    collapse all

    Path and name of base artifact database file, specified as a string.

    The base artifact database file is the common ancestor of the artifact database files that you want to merge. The path must be relative to the project root or an absolute path.

    To create a common ancestor, you can save a copy of an artifact database file by using the function padv.util.saveArtifactDatabase.

    Example: fullfile("derived", "base.dmr")

    Data Types: string

    Paths and names of artifact database files that you want to merge, specified as a string array.

    Example: [fullfile("derived", "modelA.dmr"), fullfile("derived", "modelB.dmr")]

    Data Types: string

    Path and name of merged artifact database file, specified as a string.

    The path must be relative to the project root or an absolute path.

    Example: fullfile("derived", "artifacts.dmr")

    Data Types: string

    Version History

    Introduced in R2023b