Workspace.PendEdit 未签出文件

发布于 2024-09-03 10:44:22 字数 280 浏览 2 评论 0原文

我正在使用 TFS 2010 SDK 以编程方式将对文件的编辑签入到 TFS 2010 中。TFS 2010 SDK 的文档充其量也很少。当我调用方法workspace.pendedit() 并传入一个我想要标记为具有挂起编辑的文件数组时,实际上没有签出任何内容。因此,当我调用workspace.checkin()传入workspace.getpendingchanges和一些注释时,我得到一个异常,即必须至少有一件事情有待处理的更改(这应该是我传递给pendedit的内容)。关于为什么应用程序没有将文件标记为在工作区中有待编辑的任何想法?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

偏爱你一生 2024-09-10 10:44:22

确保您按照正确的顺序执行所有操作,以便 TFS 知道文件已更改。您必须:

  1. 首先从工作区获取文件。
  2. 挂起编辑
  3. 对文件进行更改
  4. 签入工作区。

例子:

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

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

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;
向地狱狂奔 2024-09-10 10:44:22

事实证明,即使我已经添加了文件并签入了文件,工作区似乎也无法识别这些文件在那里,因此我必须在 PendEdit() 之前执行 Get()

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()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文