Author Topic: "Get All Latest" through the API?  (Read 713 times)

SANS Ltd.

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
"Get All Latest" through the API?
« on: May 20, 2015, 07:04:32 pm »
Is there a way to do a "Get All Latest" through the COM API?
Package supports the updating against a VCS repo, but Package.Update() fails with "Element Locked" after calling Package.VersionControlGetLatest(). So new sub-packages are not read. We tried to call "GetLatest" Recursively on all packages which are stored in separate XMI files.

Here is what we tried so far (from Windows Script Host, the rest of our tool runs fine):

Code: [Select]
function updatePackage(package, parentName) {
    if (package.IsControlled) {
        WScript.Echo("Updating " + parentName + "::" + package.Name + " to SVN state.");
        package.VersionControlGetLatest (/* boolean ForceImport */ true);
        repository.ScanXMIAndReconcile();
        repository.RefreshModelView(package.PackageID);
        package.Update();
    }
          
    var childPackageEnumerator = new Enumerator(package.Packages);
    while ( !childPackageEnumerator.atEnd() ) {
        var childPackage = childPackageEnumerator.item();
        updatePackage(childPackage, parentName + "::" + package.Name);
        childPackageEnumerator.moveNext();
    }
}

...

    var modelEnumerator = new Enumerator(repository.Models);
    while ( !modelEnumerator.atEnd() ) {
        var currentModel = modelEnumerator.item();
        updatePackage(currentModel, "");
        modelEnumerator.moveNext();
    }
    repository.ScanXMIAndReconcile();
    repository.RefreshModelView(0);

SANS Ltd.

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: "Get All Latest" through the API?
« Reply #1 on: June 09, 2015, 12:02:28 am »
Hi folks,

Sparx provided a solution for this issue:
http://blog.sparxsystems.de/2015/05/2222/

Regards
Florian