如何禁用或删除 TFS 中的候选更改 [英] How to disable or remove candidate changes in TFS

查看:25
本文介绍了如何禁用或删除 TFS 中的候选更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当 tfs 工作区中的文件移出 tfs 时(例如,通过 Windows 资源管理器),tfs 会将这些移动作为删除和添加进行选择.

为了解决这个问题,我运行了一个程序来监视更改,当发生移动时,我执行 Workspace.PendRename 并将 updateDisk 设置为 false.

这很好用,只是 tfs 将删除添加为候选更改.

无论如何要删除此候选更改?如果人们尝试推动这些变化,就会引起问题.

通过使用 Workspace.GetPendingChangesWithCandidates,我可以获得候选更改,但我似乎无法将其从列表中删除.

在执行 PendRename 之前,我尝试将文件移回其原始位置 (File.Move),然后在将 updateDisk 设置为 true 的情况下执行 PendRename.这实际上适用于单个文件,但当涉及文件夹等时会变得复杂.

我希望有一种简单的方法可以从列表中删除候选更改,或者甚至完全禁用某些文件/文件夹的候选更改功能.我尝试将该文件夹添加到 .tfignore 文件中,但这不起作用.

  1. 然后我们可以检查 TFS 在 VS 中检测到的内容.一个带有添加(在新的位置),一个在促进候选更改中删除(在旧位置).

  2. 您需要同时检查添加和删除(先提升).最后你会得到你想要的服务器和本地.

直接在解决方案资源管理器中移动文件

  1. 在解决方案资源管理器中,我将把 1.PNG 移动到 Main文件夹右键单击并选择移动.

  1. 您将直接获得具有重命名状态的待定更改,并且不是任何促进候选人更改.

  2. 然后我们可以检查我们的本地工作区,你会看到 1.PNG 是在工作区文件夹中自动删除,即使您尚未签入更改.最后检查待定变化,一切都很好,干净.

<小时>

回到您的问题:Promote Candidate Changes 显示删除,即使文件已重命名.

TFS API 应该使用上面的方式 2.看参数:

<块引用>

updateDisk

如果为true,则根据挂起的更改更新本地磁盘;如果为 false,则磁盘不会被修改,更改不会承认.

因此,如果您将 updateDisk 设置为 false ,则 1.PNG 应该仍然存在于磁盘中,并且 TFS 检测到它并添加以促进 Candidate Changes 显示已删除.这符合您的屏幕截图.解决方案应该是将值从 false 更改为 true.

When files in a tfs workspace are moved outside of tfs (eg. through windows explorer), tfs picks these moves up as a delete and an add.

To get around this, I have a program running that monitors for changes and when a move happens I do a Workspace.PendRename with updateDisk set to false.

This works fine except that tfs adds the delete as a candidate change.

Is there anyway to remove this candidate change? It causes issues if people try and promote these changes.

By using Workspace.GetPendingChangesWithCandidates I can get the candidate change, but there doesn't seem to be anything I can do with it to remove it from the list.

Before doing the PendRename, I tried moving the file back to it's original location (File.Move) and then doing the PendRename with updateDisk set to true. This actually works well for single files, but gets complicated when folders and such are involved.

I'm hoping there's a simple way to either remove the candidate change from the list, or to even disable the candidate changes functionality altogether for certain files/folders. I tried adding the folder to the .tfignore file but that doesn't work.

Promote Candidate Changes shows deletes even though files were renamed

解决方案

In TFS there are two kinds of moving files. I have crated a sample for both :

Local Workspace (window exploer) directly move/drag file

  1. In the disk my workspace, I'm going to move 2.PNG to Main-branch folder

  1. Then we could check what TFS detects in VS. One with add(in new place), one with delete(in old place) in Promote Candidate Changes.

  2. You need to check in both the add and delete ( promote first). Finally you will get what you want both server and local.

Move a file in solution explorer directly

  1. In the solution explorer , I'm going to move 1.PNG to Main folder by right click and select move.

  1. You will get a pending change with rename status directly and not any Promote Candidate Changes.

  2. Then we could check our local workspace, you will see 1.PNG is automatically deleted in the workspace folder even though you haven't check in changes. Finally checking pending changes, everything is fine and clean.


Back to your question: Promote Candidate Changes shows deletes even though files were renamed.

The TFS API should be using the way 2 above. Look at the parameters :

updateDisk

If true, the local disk is updated according to the pending changes; if false, the disk is not modified and changes are not acknowledged.

So if you set the updateDisk to false , the 1.PNG should still exist in the disk and TFS detect it and adding to promote Candidate Changes shows deleted. Which meets your screenshot. The solution should be change the value from false to true.

这篇关于如何禁用或删除 TFS 中的候选更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆