Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Tehila1 on May 26, 2014, 11:26:27 pm

Title: Automate Version Control Settings
Post by: Tehila1 on May 26, 2014, 11:26:27 pm
I would like to automate the process of configuring EA with version control. (Project -> Version Control -> Version Control Settings window)

The API methods I've found are related to packages that were already  controlled or after the configuration are set. I would like to automate the step before.

Is there a way to do so via API or it must be done manually?

Thanks in advance!
Title: Re: Automate Version Control Settings
Post by: Mauricio Moya (Arquesoft) on May 27, 2014, 02:57:36 am
I think part of the configuration is stored in the model database, so you can insert the suitable data directly on the database. But another part of the settings is per user, so I suppose it is stored in a local file, so if you set the local file properly you can set the version control settings for a user.
Title: Re: Automate Version Control Settings
Post by: Helmut Ortmann on May 27, 2014, 03:09:45 pm
You have to do four things to put a package under version control.

1. Set the unique ID in %APPDATA%\SPARX_Systems\EA\paths.txt
2. Use API VersionControlAdd(..)
3. Set the svn path in registry
    HKEY_CURRENT_USER\Software\SPARX Systems\EA400\EA\Options\VC_SVNExePath
4. svn Timeout in registry (VC_TIMEOUT)

I hope it's all.

Helmut
Title: Re: Automate Version Control Settings
Post by: Tehila1 on May 27, 2014, 09:56:06 pm
Thank you Helmut for your quick and detailed reply.

I followed the instructions you've posted and would like to get explication about the first step;

I set the unique id and configuration settings such as type and path to svn folder in the %APPDATA%\SPARX_Systems\EA\paths.txt file.

Then I checked if the action is reflected in EA, by selecting Settings -> Local Directories and Paths.
The new path ,indeed, exist.

But the path is still not set as a configuration:
It does not exist among the configurations defined manually- which can be displayed on Project -> Version Control -> Version Control Settings window.

Therefore, when I invoke the 'VersionControlAdd' method, the exception message I get is : "No version control configuration matches '<unique id>'.  "
 
What else should I do in order to set the local path as configuration?
Thanks in advance.
Title: Re: Automate Version Control Settings
Post by: Helmut Ortmann on May 27, 2014, 11:03:23 pm
Hi,

the entry VCConfigs is set to:
<VCConfigs><Config><GUID>svn_ac4nns</GUID><LocalPath>%svn_ac4nns%</LocalPath><UserName/><Type>2</Type></Config></VCConfigs>

%svn_ac4nns% is my Unique Identifier.

Helmut
Title: Re: Automate Version Control Settings
Post by: Tehila1 on May 27, 2014, 11:57:33 pm

Should I create in addition a registry entry called 'VCConfigs' and set it with the appropriate value?

Thanks.
Title: Re: Automate Version Control Settings
Post by: Helmut Ortmann on May 28, 2014, 12:04:42 am
If I understand it right in VCConfigs is an entry for each Unique ID.

If you have one unique ID you can simply change my values. If you have more try it by using the EA Configuration Dialog.

By the way I haven't it done with the registry yet.

Helmut
Title: Re: Automate Version Control Settings
Post by: Tehila1 on May 28, 2014, 12:14:27 am
I cannot find such an entry in the registry.
Should I  define one or I misunderstand something?
Title: Re: Automate Version Control Settings
Post by: Helmut Ortmann on May 28, 2014, 12:23:56 am
If you set the Version Control settings with EA EA creates this entry and fills it with the configured UniqueIDs.

Just configure with EA and look in the registry. All the VC information is in EA400\EA\OPTIONS.

Here is the content for two Unique IDs.

<VCConfigs><Config><GUID>svn_ac4nns</GUID><LocalPath>%svn_ac4nns%</LocalPath><UserName/><Type>2</Type></Config><Config><GUID>test</GUID><LocalPath>%test%</LocalPath><UserName/><Type>2</Type></Config></VCConfigs>

Helmut

Title: Re: Automate Version Control Settings
Post by: Tehila1 on May 28, 2014, 12:38:53 am
Digging in the registry I found only 2 entries owned by EA400\EA\OPTIONS : CALENDAR and FILTERS.

Any ideas?
Title: Re: Automate Version Control Settings
Post by: qwerty on May 28, 2014, 12:51:24 am
Create a SVN provider manually. Then search the registry for VC_SVNExePath

q.
Title: Re: Automate Version Control Settings
Post by: Helmut Ortmann on May 28, 2014, 12:56:02 am
Looks peculiar. I deleted with EA one entry and nothing changed in the registry. May be it's a bit more complicated.

Helmut
Title: Re: Automate Version Control Settings
Post by: qwerty on May 28, 2014, 01:23:35 am
Hu, yes. Deleting the registry entry and cleaning paths.txt still kept the entry. So where could that info be stored else?

q.
Title: Re: Automate Version Control Settings
Post by: qwerty on May 28, 2014, 01:30:12 am
Found it: t_genopt holds an entry with AppliesTo = VCConfigs

That just leaves the question why it's also in the registry? Does not seem to make much sense if the repository holds a value which seems to supersede its meaning. Well, it's EA...

q.
Title: Re: Automate Version Control Settings
Post by: Tehila1 on May 28, 2014, 11:20:38 pm
Trying to implement the above I want to set the t_genopt entry of VCConfig.

How can I access and update this VCConfig entry? It is the 5th entry retrieved from the following query:

Code: [Select]
SELECT t_genopt.Option FROM t_genopt
Thanks.
Title: Re: Automate Version Control Settings
Post by: qwerty on May 29, 2014, 02:51:56 am
To update the entry you need to
Code: [Select]
Repository.Execute ("UPDATE t_genopt ...") with what you need,

q.
Title: Re: Automate Version Control Settings
Post by: Tehila1 on June 09, 2014, 08:31:46 pm
Quote
You have to do four things to put a package under version control.

1. Set the unique ID in %APPDATA%\SPARX_Systems\EA\paths.txt
2. Use API VersionControlAdd(..)
3. Set the svn path in registry
    HKEY_CURRENT_USER\Software\SPARX Systems\EA400\EA\Options\VC_SVNExePath
4. svn Timeout in registry (VC_TIMEOUT)

I hope it's all.

Helmut
I followed the instructions above; create a local path via the paths.txt, modify the registry entries.  I also verify that the unique ID is exist in t_genopt.

When I try to add a package to version control via the VersionControlAdd() method, I get the following error: "Could not find connection to version control provider."

What is missing?
Thanks.
Title: Re: Automate Version Control Settings
Post by: qwerty on June 10, 2014, 01:37:56 am
Might be a security issue. Have you checked that the user has write access to the VC repo?

q.
Title: Re: Automate Version Control Settings
Post by: Tehila1 on June 10, 2014, 05:29:38 pm
Quote
Might be a security issue. Have you checked that the user has write access to the VC repo?

q.
I don't think it is a security issue. When I do this procedure manually- all right.

The configuration is still not set correctly despite the local path exists.
The package control options dialog looks like this:

Version Control : configName: (requires configuration)
File Name : %configName%\packageName.xml

Any ideas?
Title: Re: Automate Version Control Settings
Post by: Tehila1 on June 16, 2014, 10:23:52 pm
Quote
You have to do four things to put a package under version control.

1. Set the unique ID in %APPDATA%\SPARX_Systems\EA\paths.txt
2. Use API VersionControlAdd(..)
3. Set the svn path in registry
    HKEY_CURRENT_USER\Software\SPARX Systems\EA400\EA\Options\VC_SVNExePath
4. svn Timeout in registry (VC_TIMEOUT)

I hope it's all.

Helmut

There must be something we missed since it still does not work properly.

Is there another registry entry or database value that keeps data for this purpose?
The registry I've modified is the same as manual-defined configurations and I do not see something different.

Thanks in advance!