将特定版本放入单独的文件夹

我目前正在进行一个 TFS 源代码控制的项目。我们刚刚收到一个旧版本代码的 bug 报告,我需要下拉那个版本的代码来测试它。我的第一个想法是“获取特定版本”来下拉代码,但是我不希望将该版本放到当前的工作区目录中。

有没有一个简单的方法把“获取特定版本”放到一个单独的文件夹(例如临时/扔掉的文件夹) ,这样我就可以在旧版本的代码中快速查看这个 bug,而不会干扰我当前的工作?

40601 次浏览

I just found one easy way to do this: Create a new Workspace in TFS pointing to a separate folder, then switchover to this new workspace and do a Get Specific Version here.

Makes sense now, I just hadn't ever tried that.

OK, this is a very old question but still one that comes up. An alternative would be to shelve any changes you currently have, then undo changes locally so you are at the most up to date version from TFS, and then do your Get Specific Version. Once you're finished with it you can then get latest (if you're worried about it, you can dump the code you have locally first) and unshelve your changes again.

It's not without risk but given TFS's irritating and outdated workspace model it's about the best you can hope for without going to the trouble of mapping a whole new workspace or other faffing about.

You can create a branch with version by

  • Change Set
  • Latest Version
  • Label
  • Date
  • Workspace Version

Then use that branch for fixing the bug and merge back the changes if required or release the branch itself.

For making edits to a single file, here's a quick hack from within Visual Studio:

  1. Open Source Control Explorer
  2. Drill down to desired file
  3. File > Source Control > View History
  4. Select desired version (Changeset)
  5. Toolbar/Context Menu > Compare
  6. Click in left pane, Select All, Copy, paste into Your Favorite Editor and save