开发者

Workspace.PendEdit not checking out files

I'm开发者_运维知识库 using the TFS 2010 SDK to programmatically check in edits to files into TFS 2010. The documentation on the TFS 2010 SDK is sparse at best. When I call the method workspace.pendedit() passing in an array of files I want to mark as having a pending edit, nothing is actually checked out. So when I call workspace.checkin() passing in workspace.getpendingchanges and some comments I get an exception that there must be at least one thing that has a pending change (which should be what I passed into pendedit). Any thoughts on why the app isn't marking the files as having a pending edit in the workspace?


Make sure you're doing everything in the right order so TFS knows that the file has changed. You have to:

  1. Get the file from the workspace first.
  2. Pend the edit
  3. Make the changes to the file
  4. Check in the workspace.

Example:

    GetStatus status = workspace.Get(new GetRequest(migrationPath, RecursionType.None, 
                                             VersionSpec.Latest),GetOptions.Overwrite);
    workspace.PendEdit(migrationPath);

    checkInAuthor = System.Security.Principal.WindowsIdentity.GetCurrent().Name;


It turned out that even though I had added the files and checked in the files, it seemed that the workspace didn't recognize that the files were there, and as a result I had to do a Get() prior to the PendEdit()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜