且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在TFS中禁用或删除候选更改

更新时间:2023-12-05 09:48:16

在TFS中,有两种移动文件.我为这两个都创建了一个示例:

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

  1. 在磁盘上,我将工作区 2.PNG 移至 Main-branch 文件夹
  1. In the disk my workspace, I'm going to move 2.PNG to Main-branch folder

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

  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.

您需要同时检查添加和删除(首先升级).最后 您将获得所需的服务器和本地服务器.

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

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

  1. 在解决方案资源管理器中,我将把 1.PNG 移到 Main 右键单击文件夹,然后选择移动".
  1. In the solution explorer , I'm going to move 1.PNG to Main folder by right click and select move.

  1. 您将直接获得状态为重命名的待处理更改, 没有任何促进候选人变更.

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

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

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.


回到您的问题:升级候选更改显示删除,即使文件已重命名.

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

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

updateDisk

如果为true,则根据挂起的更改来更新本地磁盘;否则,将更新本地磁盘. 如果为false,则磁盘未修改且更改未进行 确认.

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

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

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.