Page 1 of 1

Check in files using ChangeSetItem_???

Posted: Thu Apr 26, 2012 6:20 pm
by carysyd
Hi,

I'm writing a C# program to automatically add/checkin files to Vault. Basically the C# program knows a list of files to add and check in, then the program would commit the changes in one batch.

I have no problem creating folder and adding new files using a

Code: Select all

ChangeSetItemColl 
and then add

Code: Select all

ChangeSetItem_AddFile 
and

Code: Select all

ChangeSetItem_CreateFolder
.

My question: could you please share a code example of change set item that check in a modified file?

Thank you.

Re: Check in files using ChangeSetItem_???

Posted: Fri Apr 27, 2012 12:37 pm
by lbauer
Take a look at the client instance's internal change set; it may already have the checkouts within the list, and just a ProcessCommandCommit() is all that is needed.

If you want more control, then ProcessCommandCheckIn() should work for you.

Re: Check in files using ChangeSetItem_???

Posted: Mon Apr 30, 2012 5:32 pm
by carysyd
Hi,

Thanks for the quick response.

I managed to get ProcessCommandCheckIn() working, however, this is a "immediate" action rather than queuing up in the ChangeSetItemColl. The later allows a batch operation and would rollback if commit failed.

Could I do the same with ChangeSetItem_Modified? I assume this is the function to "check-in" files?

Thank you.

Regards,
Cary

Re: Check in files using ChangeSetItem_???

Posted: Tue May 01, 2012 2:49 pm
by lbauer
If you want to commit what is in the change set - then I suggest following the Command Line Client's code for the COMMIT operation. The CLC code is included in the Vault Client API folder.

Re: Check in files using ChangeSetItem_???

Posted: Thu Jul 26, 2012 7:38 pm
by carysyd
Hi,

Now I have a problem with check ins. After a successful check out, the file appears as "Needs Merge" in Vault Client. The ProcessCommandCheckIns couldn't check in the file (possibly because of the state", but it doesn't throw an exception.

What I want is to check in whatever it is on the local folder (aka, discard the version in Vault Source Control), could you please share some code to resolve the state?

Thank you.

Regards,
Cary

Re: Check in files using ChangeSetItem_???

Posted: Tue Jul 31, 2012 2:54 pm
by lbauer
I believe ProcessCommandCommit() has a merge flag for "resolveMerge."

Perhaps using that method with resolveMerge set to "true" may work you.

You may want to test this and check the merge results, because if there's a conflict, resolve merge will revert back to the common ancestor of the two modifications.