【问题标题】:Undo unchanged pending changes with Tfs power tools not working在 Tfs 电动工具不起作用的情况下撤消未更改的待处理更改
【发布时间】:2016-06-27 04:46:54
【问题描述】:

使用 Tfs 2015,在我的 dev 文件夹中运行以下命令时:

tfpt uu \ noget \recursive

它告诉我: 没有多余的未决更改,尽管在我的工作区中有 15 个文件处于未决更改中,但根本没有更改。

有谁知道这个命令对我不起作用吗?

【问题讨论】:

  • 另一个原因可能是毫无根据的合并——包括从创建后重命名的分支合并,在这种情况下,VS 合并向导甚至没有提到它是毫无根据的合并。有关更多详细信息,请参阅此答案 (stackoverflow.com/a/15621451/1633949)。据我所知,没有补救办法。最好的建议似乎是:不要重命名一个分支,直到你确定你永远不需要再次合并它。 (此评论是出于自身利益。两次,相隔几个月,我遇到了这个问题,谷歌搜索首先引导我找到这个问题。)
  • 正如对其中一个答案的评论中提到的,斜线不正确。他们应该是正斜杠。 tfpt你。 /noget /recursive 但是,即使进行了此更正,未更改的文件仍可能无法检测到。
  • 在这里找到了解决方法:stackoverflow.com/a/15643286/1633949

标签: tfs tfs-power-tools


【解决方案1】:

特别是关于您的示例场景 - 一个怪癖是,在您的示例中,您使用反斜杠而不是正斜杠的斜杠的方向无法按预期工作。

我专门测试了您的场景,并且可以在尝试以下情况时使用反斜杠模拟您的结果。

编辑:测试结果操作场景

Visual Studio 2015 企业版(版本:14.0.23107.0 D14REL)

TFS Powertools 2015(版本 14.0.23206.0)

  1. 带正斜杠 /
D:\src\testapp\src1>tfpt uu /recursive /noget
Getting the list of pending changes for your workspace...
Building the list of redundant changes...
 edit (contents match): d:\src\testapp\src1\file_with_pending_change.txt
Do you wish to undo these redundant pending changes? (Y/N) n
Operation canceled.
  1. 带反斜杠 \
D:\src\testapp\src1>tfpt uu \recursive \noget
Bringing the specified items up to the latest version…
Getting the list of pending changes for your workspace...
There are no redundant pending changes.
  1. 再次使用正斜杠 /
D:\src\testapp\src1>tfpt uu /recursive /noget
Getting the list of pending changes for your workspace...
Building the list of redundant changes...
 edit (contents match): d:\src\testapp\src1\file_with_pending_change.txt
Do you wish to undo these redundant pending changes? (Y/N) y
Undoing redundant changes...
edit: file_with_pending_change.txt
1 changes undone.

编辑 2:操作问题.. 在这个答案的 cmets 中,我建议 OP 删除 TFS 缓存以便从已知的基线状态开始,因为在测试了我的解决方案并且没有得到预期的结果之后,这似乎确实是一个损坏的工作区状态问题。

可以通过关闭IDE并删除其中的文件来删除缓存

C:\Users\USERNAME\AppData\Local\Microsoft\Team Foundation\XXXX\Cache

然后再次打开 IDE 并检查幽灵挂起的更改是否仍然出现。在未决更改仍然出现的情况下,我建议搁置或提交想要保留的更改并删除工作区。

关于 TFPT 的附加说明: 如果 tfpt 工作路径 不在映射的工作空间路径中,则 tfpt 命令将产生指定的消息 -

示例:

我有一个名为:

的服务器路径

$/serverpath/testapp/src1

我将该路径映射到本地:

D:\src\testapp\src1

为了模拟,然后我明确地检查 src1 中的文本文件进行编辑。

tfpt uu /recursive /nogetD:\src\testapp 执行会导致

Bringing the specified items up to the latest version... 
Getting the list of pending changes for your workspace... 
There are no redundant pending changes.

tfpt uu /recursive /nogetD:\src\testapp\src1 执行会导致

Getting the list of pending changes for your workspace...
Building the list of redundant changes...
 edit (contents match): d:\src\testapp\src1\file_with_pending_change.txt
Do you wish to undo these redundant pending changes? (Y/N) y
Undoing redundant changes... 
edit: file_with_pending_change.txt
1 changes undone.

相关说明:

您也可以运行标准 TF 命令,尽管您将明确添加 TF.exe 执行的路径:

tf undo /recursive D:\src\testapp\src1

导致:

Undoing edit: file_with_pending_change.txt

【讨论】:

  • 我从本地映射路径运行命令.. 它总是说:获取工作区的待处理更改列表...构建冗余更改列表...没有多余的待处理更改.
  • @S.Peter 您能否确认您具体在本地映射路径中,而不是其父路径之一,并且您确实使用的是正斜杠而不是反斜杠斜线?
  • 现在肯定使用正斜杠,我尝试从每个映射文件夹运行它,从最高父级到我的代码所在的文件夹..不工作
  • 您是否尝试过删除您的 tfs 缓存? C:\Users\USERNAME\AppData\Local\Microsoft\Team Foundation\XXXX\Cache 然后检查您的 IDE 源代码控制浏览器,看看这 15 个文件是否仍显示为待处理?请关闭您的 IDE,删除缓存,再试一次,我的下一个怀疑是您的工作区已经以某种方式损坏了......如果是这样,我会简单地签入和/或搁置我真正想要的更改并完全删除工作区,然后重新创建它。
  • 嘿,关于那个命令,当我将文件添加到项目并运行它时,它会将那个 csproj 文件视为未更改,它应该这样做吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-20
  • 1970-01-01
  • 2018-03-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多