TFS:按旧名称查找移动的文件

发布于 12-04 08:21 字数 265 浏览 0 评论 0原文

如果您只知道文件的旧名称,有没有办法获取文件的版本历史记录?

我目前正在查看我们存储库的旧副本(我不知道确切的日期,该副本已被拍摄)。当我将它与当前存储库进行比较时,有一个文件仅存在于副本中,但不存在于当前存储库中。它尚未在存储库中删除。我猜,它已被移动或重命名。 TFS 中有什么方法可以使用旧路径和名称查找版本历史记录吗?

我知道我可以使用名称或一些代码片段进行挖掘。但在我看来,使用存储库时这不是一个可接受的解决方案:)

非常感谢

Andreas

is there a way to get the version-history of a file if you only know an old name of the file?

I am currently looking at an old copy of our repository (I don't know the exact date, the copy was taken). When I compare it to the current repository, there is one file, that only exists in the copy, but not in the current repository. It has not been deleted in the repository. I guess, it has been moved or renamed. Is there any way in TFS to find the version-history using the old path and name?

I know that I could dig around using the name or some code-fragments. But IMO this is not an acceptable solution when using a repository :)

Thank you very much

Andreas

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

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

发布评论

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

评论(2

彩虹直至黑白2024-12-11 08:21:21

在 Team Explorer 2010 中,您只需打开“显示已删除的文件”选项并导航到原始文件夹,您就可以看到已移动或删除的文件。您可以查看该项目的历史记录以查看其最后的更改集 - 这将显示它是否被彻底删除,或者它是否只是被重命名,因此该项目不再存在于当前路径名称(也称为“插槽”)中并被删除那样。您可以进一步深入查看该变更集的变更集详细信息,以查看该项目占用的新路径名称(槽)。

正如您提到的,您当然可以使用 GetItems 方法对 TFS API 进行一些 bash 操作。虽然我知道这不是您想要做的,但我认为值得一提,因为 TFS API 非常容易使用。

In Team Explorer 2010, you can simply turn on the "Show Deleted Files" option and navigate to the original folder, you'll be able to then see the file that was moved or deleted. You can view history on the item to see its last changeset - this will show you whether it was outright deleted, or if it was just renamed and thus the item no longer exists in the current path name (aka "slot") and was deleted that way. You can further drill down in to changeset details for that changeset to see the new path name (slot) that item occupies.

As you mention, you could certainly do this with a little bash against the TFS API using the GetItems method. Though I understand that it's not what you want to do, I thought it worth saying just because the TFS API is surprisingly easy to work with.

紫轩蝶泪2024-12-11 08:21:21

一些简单的方法(其他答案中尚未建议)可能会有所帮助:

在您的存储库中,转到用于包含文件的文件夹,右键单击并选择显示历史。这将显示该文件夹中文件的所有版本更改。现在查看文件夹中不再存在的文件的更改列表,然后双击它们进行查看并确定该文件是否看起来像新文件的祖先。

或者采用强力方法:将所有源代码放到磁盘上,然后搜索与您要查找的文件同名的文件,或者其中包含某些相同文本的文件(我会查找看起来可能已经过时的注释,并且使用了不太可能出现在许多地方的独特措辞,与如果文件重命名则可能被重构的类/方法名称相比,注释不太可能发生更改)

Grep 可能。是一个丑陋、野蛮的力量解决问题的方法,但有时这是最快、最简单的。 TFS CLI 工具功能强大,但无用、复杂且文档缺乏,因此除非您已经是专家,否则它们可能需要进行大量试验和错误才能完成您想要的操作。

A couple of simple approaches (not already suggested in other answers) may help:

In your new repository, go to the folder that used to contain the old file, right click and show History. This will show all the versioned changes to files in that folder. Now look through the list of changes for files that no longer exist in the folder, and double click them to view them and determine if the file looks like an ancestorof your new file.

Or go for a brute force approach: get all the source code onto your disk and search for files of the same name, or files with some of the same text in them, as the file you're looking for (I'd look for comments that seem like they might be faily old and which use a distinctive wording that is unlikely to have appeared in many places. Comments are less likely to have changed than class/method names that might have been refactored if the file was renamed)

Grep may be an ugly, brute force way of approaching the problem, but sometimes it's the quickest and easiest. The TFS CLI tools are powerful, but unhelpful, complex and poorly documented, so unless you're already an expert, they can take a lot of trial and error to get them to do what you want.

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