在重构期间丢失文件的 SVN 历史记录 [英] Losing SVN history on files during refactoring

查看:46
本文介绍了在重构期间丢失文件的 SVN 历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一些重构过程中,我在四处移动文件.显然,SVN 认为这是删除文件并创建一个新文件,因为 IDE 不会触发 SVN 重命名/移动操作.然而,我认为 SVN 服务器会足够聪明来检测它,但事实证明并非如此......无论如何都不是.我正在使用 Tortoise SVN 并且我正在取消选中停止复制/重命名"按钮.

During some refactoring, I'm moving files around. Obviously SVN sees this as deleting the file and creating a new one since the IDE doesn't trigger an SVN rename/move operation. However I thought the SVN server would be smart enough to detect it, but this is not proving to be the case... not all the time anyway. I'm using Tortoise SVN and I am unchecking the "stop on copy/rename" button.

这是预期的吗?有没有办法绕过它?我应该使用 Tortoise SVN shell 命令移动文件而不是让 IDE 执行常规文件移动吗?

Is this expected? Is there a way round it? Should I move files using Tortoise SVN shell commands rather than letting the IDE do a regular file move?

另外,如果 SVN 不知道,是否可以手动强制 SVN 将两个文件链接为同一个实体?就像告诉它/com/john/test.tct 和/com/john/test/file.txt 一样"?

Also, is it possible to manually force SVN to link two files as the same entity if it doesn't know? Like tell it "/com/john/test.tct is the same as /com/john/test/file.txt"?

推荐答案

SVN 的做法实际上是让 SVN 重命名文件(svn move 或使用 TortoiseSVN 的重命名").但是,如果您绝对必须有一些外部工具来执行重命名操作,则可以使用 TortoiseSVN 来修复移动操作.以下将告诉 SVN 新文件实际上是重命名的旧文件:

The SVN way to do this is actually to have SVN rename the file (svn move or using TortoiseSVN's "Rename"). However, if you absolutely must have some external tool to perform the rename operation, you can use TortoiseSVN to repair the move operation. The following will tell SVN that the new file is actually the renamed old one:

  1. 打开检查修改"窗口.
  2. 标记旧文件名(列为缺失)和新文件名(列为未版本)
  3. 右键单击此选项并选择修复移动".

注意:我是凭记忆打字的.它可能不完全正确.可能还有其他方法可以做到这一点(例如在资源管理器中标记文件).

Note: I'm typing this from memory. It might not be fully correct. And there might be other ways to do this (like marking the files in the explorer).

如果你已经丢失了一个文件的历史记录,你很想念它,你可以复活旧文件(你可以通过svn copy将旧版本的版本复制到旧位置来做到这一点),合并将新文件的历史记录写入其中,然后删除新文件,并将旧文件 svn move 移至新文件的名称.

If you already lost the history on a file where you miss it badly, you could resurrect the old file (you do this by svn copying an old revision's version into its old place), merge the new file's history into it, then delete the new file, and svn move the old file to the new file's name.

这篇关于在重构期间丢失文件的 SVN 历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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