重命名文件并用 Subversion 中先前版本的文件替换旧文件名

发布于 2024-09-10 21:09:44 字数 422 浏览 3 评论 0原文

我在 Windows 中使用 TortoiseSVN 检查了一个 Subversion 分支。我有一个文件,将其命名为 myfile.txt,我想将其重命名为 mynewfile.txt。然而,我想保留 myfile.txt,并将其恢复到以前的版本,例如 r15。因此,我希望 myfile.txt 具有来自 r15 的内容,并且 mynewfile.txt 具有来自 rHEAD 的 myfile.txt 内容。我希望我能用 Subversion 命令以某种方式做到这一点,以便保留文件的历史记录。这样,当我提交此内容并且您查看修改时,您可以看到 mynewfile.txt 只是 myfile.txt 的重命名,并且 myfile.txt 现在具有 r15 中的旧内容。这可能吗?我应该重命名 myfile.txt -> mynewfile.txt 然后重新制作 myfile.txt,手动将内容从 r15 复制到其中?

I have a Subversion branch checked out using TortoiseSVN in Windows. I have a file, call it myfile.txt, that I want to rename, say to mynewfile.txt. I want to keep myfile.txt around, however, and just revert it back to a previous revision, say r15. So, I want myfile.txt to have content from r15 and mynewfile.txt to have myfile.txt's content from rHEAD. I was hoping I could somehow do this with Subversion commands so that the history of the file is preserved. That way, when I commit this and you look at the modifications, you can see mynewfile.txt is just a rename of myfile.txt, and myfile.txt now has its old content from r15. Is this possible? Should I just rename myfile.txt -> mynewfile.txt and then remake myfile.txt, manually copying content from r15 into it?

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

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

发布评论

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

评论(2

云巢 2024-09-17 21:09:44
svn cp myfile.txt mynewfile.txt
svn co -r15 myfile.txt
svn commit

我相信这会如你所愿地保留历史。

编辑:TortoiseSVN,没有意识到!新步骤:

  1. 打开存储库浏览器并右键单击 myfile.txt
  2. 选择“复制到...”并选择 mynewfile.txt 作为新名称。
  3. 右键单击签出副本中的 myfile.txt,然后选择“更新到修订版本”,然后选择 15.
  4. 提交。
svn cp myfile.txt mynewfile.txt
svn co -r15 myfile.txt
svn commit

I believe that would preserve the history as you wish.

EDIT: TortoiseSVN, did not realize! New steps:

  1. Open the Repo Browser and Right-click your myfile.txt
  2. Select "Copy to..." and choose mynewfile.txt as the new name.
  3. Right-click myfile.txt in a checked-out copy and choose "Update to revision" and select 15.
  4. Commit.
红ご颜醉 2024-09-17 21:09:44

您需要旧版本的第二个工作副本(复制目录并仅更新单个文件就足够了)。然后需要执行以下步骤:

  • 在 HEAD 工作副本中从 svn 上下文菜单中选择rename 重命名文件
  • 转到 OLD 工作副本并将旧文件拖到 HEAD 工作副本使用鼠标右键
  • 从出现的菜单
  • 提交中选择svn copy versioned items here(确保旧文件的文本状态显示“已替换(+)”,并且“已添加(+ )”为新文件)

You need a second working copy at the old revision(It is sufficient to copy the directory and update the single file only). Then you need to perform the following steps:

  • In the HEAD working copy Choose rename from the svn context menu to rename the file
  • go to the OLD working copy and drag the old file to the HEAD working copy with the right mouse button
  • chose svn copy versioned items here from the appearing menu
  • commit (make sure the text status says "replaced(+)" for the old file and "added(+)" for the new file)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文