Author Topic: MergeInstructions  (Read 1792 times)

mvinca

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
MergeInstructions
« on: February 19, 2011, 12:27:54 am »
I want to programmatically restore a package to an older baseline. From the Help File, it seems that DoBaselineMerge would be the way to do this (even though it is a restore, not a merge). So I have code that looks like this:
            proj.DoBaselineMerge( PackageGuid, baselineGridView.Rows[beforeRow].Cells["guid"].Value.ToString(),
                "<Merge><MergeItem guid=\"RestoreAll\" /></Merge>", null );

When this code runs, EA does "something" (Baseline Compare utility comes up and runs) but when it is complete, my package looks like it always did. [A manual compare to the most recent baseline confirms this]. It doesn't seem to be updated (reverted) at all. I'm assuming the MergeInstructions are wrong. Can anyone help?

philchudley

  • EA User
  • **
  • Posts: 605
  • Karma: +13/-0
  • UML/EA Principal Consultant / Trainer
    • View Profile
Re: MergeInstructions
« Reply #1 on: February 19, 2011, 03:36:45 am »
I haven't actually performed any automation of baselines, but I have wriiten a number of Add-Ins.

From the EA User Guide the DoBaseLineMerge has the following signature

DoBaselineMerge(string PackageGUID, string Baseline, string MergeInstructions, string ConnectString)

It appears from your post, that you have not specifed the package name, so perhaps (I am guessing), EA tries to achieve a merge using the latest baseline which happens to be identical to the current model?

Although I would have thought that if the signature was incorrect, then the code would not have compiled.

A colleague of mine has automated baseline merges, so I'll dig out his code, and hopefully post a more detailed reply.

Cheers

Phil
follow me on Twitter

@SparxEAGuru

mvinca

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: MergeInstructions
« Reply #2 on: February 19, 2011, 03:49:15 am »
The only thing I haven't supplied is the ConnectString. Or do you mean I have to supply the PackageName in the MergeInstructions?

qwerty

  • EA Guru
  • *****
  • Posts: 11319
  • Karma: +287/-259
  • I'm no guru at all
    • View Profile
Re: MergeInstructions
« Reply #3 on: February 19, 2011, 06:01:22 am »
I guess you need to supply some XML, not a single GUID:
Code: [Select]
<Merge>
       <MergeItem guid="RestoreAll" />
</Merge>

q.

mvinca

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: MergeInstructions
« Reply #4 on: February 19, 2011, 06:06:17 am »
I'm supplying that in the third parameter.  :)

qwerty

  • EA Guru
  • *****
  • Posts: 11319
  • Karma: +287/-259
  • I'm no guru at all
    • View Profile
Re: MergeInstructions
« Reply #5 on: February 21, 2011, 09:14:54 pm »
Sorry. I should have put on my glasses...

q.

mvinca

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: MergeInstructions
« Reply #6 on: February 25, 2011, 09:45:11 pm »
From Tech Support, for everyone's information:

Upon investigation, our developers report that the documentation on this
subject is currently incorrect.  The MergeItem xml node has additional
attributes when using "RestoreAll" that are not currently documented.

Example:

<Merge>
<MergeItem guid="RestoreAll" changed="true" baselineOnly="true"
modelOnly="true" moved="true" fullrestore="false" />
</Merge>