Welcome to MSDN Blogs Sign in | Join | Help

VC API: CheckIn() may return 0

Back in March, I wrote a post called How to check in changes on behalf of other users.  Among other things, you'll find the documentation comments for the Workspace.CheckIn() method, which you'll notice is now on MSDN.  While that and How to validate check-in policies, evaluate check-in notes, and check for conflicts are probably the best documentation on how to use CheckIn(), I didn't mention that CheckIn(), which returns the changeset created by checking in, may return 0.

The version control server automatically undoes the pending changes in the case where you attempt to check in files that haven't changed rather than create new versions of them.  In the extreme case, CheckIn() will return 0 when all of the changes being checked in are edits without content changes or locks.  Nothing bad happened, but the server did not create a changeset.  If something bad happened, such as having one or more conflicts, CheckIn() will throw an exception.

The CommitCheckinEventArgs object, available by listening to the VersionControlServer object's CommitCheckin event, contains the list of files that were actually checked in (Changes) and the files that were undone (UndoneChanges).

tags: , , ,

Published Monday, September 18, 2006 11:33 PM by buckh

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# VSTS Links - 09/19/2006

Grant Holliday on OzTFS.com Launched.

Buck Hodges on VC API: CheckIn() may return 0.

Martin Woodward...
Tuesday, September 19, 2006 8:36 AM by Team System News

# An introduction, 1350 posts later

On the Microsoft forums , that is...no, I didn't suddenly eclipse Raymond . As you probably haven't noticed,

Tuesday, October 17, 2006 3:23 AM by BUGBUG: poor title

# Keyword expansion in TFS

Periodically, the topic of keyword expansion comes up, which TFS (at least through 2008) does not support.

Saturday, July 07, 2007 1:56 PM by Buck Hodges

# Keyword expansion in TFS

Periodically, the topic of keyword expansion comes up, which TFS (at least through 2008) does not support

Saturday, July 07, 2007 3:08 PM by Noticias externas

# re: VC API: CheckIn() may return 0

Is there a way to FORCE an unmodified file to be checked in? This way you know whomever gets the changeset will also get this "unmodified" file.

Friday, July 18, 2008 1:22 PM by Jacob

# re: VC API: CheckIn() may return 0

Jacob, no there is not.  You must make some change, even if it is only adding a space.

Buck

Wednesday, July 30, 2008 10:15 PM by buckh

# re: VC API: CheckIn() may return 0

i'm trying to handle the CommitCheckin event in a VSPackage, but Visual Studio crashes after running my event code.  i've posted in the forums but noone is responding.  can you point me in the right direction?

Thursday, December 18, 2008 5:29 PM by burton

# re: VC API: CheckIn() may return 0

Burton, I'd suggest connecting a debugger to VS and getting a stack trace.  You may be accessing a field that is null.

Buck

Monday, January 05, 2009 9:37 PM by buckh

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker