Check in files using ChangeSetItem_???

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
carysyd
Posts: 3
Joined: Thu Apr 26, 2012 6:02 pm

Check in files using ChangeSetItem_???

Post by carysyd » Thu Apr 26, 2012 6:20 pm

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.

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Check in files using ChangeSetItem_???

Post by lbauer » Fri Apr 27, 2012 12:37 pm

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.
Linda Bauer
SourceGear
Technical Support Manager

carysyd
Posts: 3
Joined: Thu Apr 26, 2012 6:02 pm

Re: Check in files using ChangeSetItem_???

Post by carysyd » Mon Apr 30, 2012 5:32 pm

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

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Check in files using ChangeSetItem_???

Post by lbauer » Tue May 01, 2012 2:49 pm

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.
Linda Bauer
SourceGear
Technical Support Manager

carysyd
Posts: 3
Joined: Thu Apr 26, 2012 6:02 pm

Re: Check in files using ChangeSetItem_???

Post by carysyd » Thu Jul 26, 2012 7:38 pm

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

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Re: Check in files using ChangeSetItem_???

Post by lbauer » Tue Jul 31, 2012 2:54 pm

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.
Linda Bauer
SourceGear
Technical Support Manager

Post Reply