Vault Client API - URGENT! Need example of checking in file

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
Jim Cline

Vault Client API - URGENT! Need example of checking in file

Post by Jim Cline » Fri Feb 27, 2004 1:32 pm

I am stumped and need to be able to checkin a file that I just checked out and modified in code.

Thanks,
-Jim

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Fri Feb 27, 2004 2:48 pm

Calling ClientInstance.Commit() should do the trick. Commit() with no args will attempt to commit all the change set items in the internal change set. If you only want to commit a few of the items in your change set, call Commit(ChangeSetItemColl). There is also a Commit(ChangeSetItemColl,bool,bool), which allows for keeping files checked out and removing local copies.

If you're calling any of these Commit functions, and it doesn't seem to be doing anything, hook up an event handler to ClientInstance.NewMessage, and watch the messages that are sent to your callback. These are the strings that go into the message pane in the GUI client.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

Jim Cline

Thanks

Post by Jim Cline » Fri Feb 27, 2004 2:58 pm

It doesn't seem to check it in and it returns false. So I will definitely checkout the message event.

-Jim

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Fri Feb 27, 2004 4:12 pm

One thing I forgot to mention was that the internal change set is persistent. If you add something to it (like a "Create Folder" change set item), it will stay there until you either undo it or commit it. If you later check out a file (it will then appear in the internal change set too), and call commit with no arguments, both items will be committed. If the first is failing (maybe because the destination name is invalid), the whole transaction will keep failing.

The workaround is to do what I think you said you were doing in your other message: call the commit that takes the ChangeSetItemColl and put only one of the items from InternalChangeSet_Get in it.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

Jim Cline

Ok I have narrowed down the problem

Post by Jim Cline » Fri Feb 27, 2004 10:03 pm

(this is all using the Vault Client API)

If I Open vault, check out a file, modify it and then try to check it back in, it fails.

...but...

If I Open vault, check out a file, modify it, then logout, Open vault again, then try to check in the file, it works.

So, it seems like theres something I need to do in between checking it out and checking back to let the "Client" know that it has changed.

Any ideas?

-Jim

sterwill
Posts: 256
Joined: Thu Nov 06, 2003 10:01 am
Location: SourceGear

Post by sterwill » Sat Feb 28, 2004 9:27 am

Hm... you might try a call to InternalChangeSet_RefreshKnown in between (I think that's the name of the function, I don't have the code with me now).
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`

Jim Cline

I think I have it...

Post by Jim Cline » Sun Feb 29, 2004 10:11 pm

I put a ClientInstance.DoLocalRefresh() call and it seems to work...from the documentation I would not have guessed this would have worked but...I'll take it!

Thanks,
Jim

Post Reply