TFS Meltdown - 如何恢复搁置的更改 [英] TFS Meltdown - How can I recover shelved changes

查看:26
本文介绍了TFS Meltdown - 如何恢复搁置的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的工作文件夹设置为 RAM 驱动器.晚上停电时间很长,UPS 用完了,我的机器坏了.值得庆幸的是,我在回家之前搁置了我的更改,并且该搁置集在团队资源管理器中可见.变更集包括项目文件和一些尚未添加到源代码管理中的新文件.

I had my working folder set to a RAM drive. During the night there was an extended power outage, the UPS ran out and my machine went down. Thankfully I shelved my changes before I went home and that shelveset is visible in Team Explorer. The changeset includes the project file and some new files which have not yet been added to source control.

我正在尝试恢复受影响的文件,但出现错误:

I'm attempting to recover the affected files but am getting errors:

尝试查看搁​​置的文件会给出 TF10187(或一般的未编号)系统找不到指定的文件,即使我可以在 中看到它们待定更改列表.

Attempting to view the shelved files gives TF10187 (or a general, unnumbered) The system cannot find the file specified even though I can see them in the Pending Changes list.

尝试取消整个集合的搁置会导致与不兼容更改相关的错误,我无法解决.

Attempting to unshelve the set in its entirety gives errors relating to incompatible changes which I can't resolve.

猜测 TFS 在 RAM 磁盘上本地缓存了搁置集,该磁盘已经重新初始化并因此丢失了缓存,但我希望我错了.

I'm guessing TFS cached the shelveset locally on the RAM disc which has since reinitialised itself and therefore lost the cache, but I'm hoping I'm wrong.

有人可以帮忙吗?

推荐答案

昨天有人来问我同样的问题,幸运的是他们有 TFS 项目数据库 (tfs_) 的备份,所以我们将其恢复到另一个数据库我摸索了一下,想通了(所以,如果你有备份,那么是的,你可以恢复所有文件).

I had someone come to me and ask the same question yesterday, fortunately they had a backup of the TFS Project database (tfs_) so we restored that to another database and I poked around and figured it out (so, if you have a backup then yes, you can recover all the files).

首先是关于数据库中表的一些信息.

First of all a little info on the tables in the database.

可以通过查询 tbl_Workspace 表并查找所有 Type=1(Shelvesset)的记录来识别 Shelveset,当然您也可以使用 WorkspaceName 列按名称过滤.

A Shelveset can be identified by querying the tbl_Workspace table and looking for all records with Type=1 (Shelveset), you can of course also filter by name with the WorkspaceName column.

其他感兴趣的表是:

tbl_PendingChanges(从 tbl_Workspace 引用 WorkspaceId)——哪些文件是 ShelveSet 的一部分

tbl_PendingChanges (which references the WorkspaceId from tbl_Workspace) - which files are part of the ShelveSet

tbl_VersionedItem(通过 ItemId 列链接到 tbl_PendingChanges) - 文件的父路径和名称

tbl_VersionedItem (linked via ItemId column to tbl_PendingChanges) - parent path and name of files

tbl_Content(通过 FileId 链接到 PendingChanges) - 这是您的文件内容作为压缩 (gzip) 数据存储的位置

tbl_Content (linked via FileId to PendingChanges) - this is where your file content is stored in as compressed (gzip) data

现在是解决方案;以下查询可以显示您的文件:

Now for the solution; the following query can show you your files:

SELECT c.[CreationDate], c.[Content], vi.[ChildItem], vi.ParentPath
FROM [dbo].[tbl_Content] c 
INNER JOIN [dbo].[tbl_PendingChange] pc ON pc.FileId = c.FileId
INNER JOIN [dbo].[tbl_Workspace] w ON w.WorkspaceId = pc.WorkspaceId
INNER JOIN [dbo].[tbl_VersionedItem] vi ON vi.ItemId = pc.ItemId
WHERE w.WorkspaceName = '<YOUR SHELVESET NAME>'

我写了一些代码从 SQL 取回数据,然后用 GZipStream 类解压内容并将文件保存到磁盘.

With that I wrote some code to get the data back from SQL and then decompress the content with the GZipStream class and save the files off to disk.

一周左右的工作就回来了.

A week of work was back in an hour or so.

这是在 TFS 2010 中完成的.

This was done with TFS 2010.

希望这会有所帮助!

这篇关于TFS Meltdown - 如何恢复搁置的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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