将源文件移动到新项目..如何在新项目中保留旧提交版本的 SVN 历史记录
我正在将源文件从 netbeans 中的 Web 应用程序项目移动到 netbeans 中的新 Maven Web 应用程序项目。由于我的项目位于 subversion 存储库下,因此我需要将新创建的项目与存储库中旧项目的已提交版本合并,以保持历史记录仍然存在。如何合并 subversion 存储库中的两个项目
I am moving source files from a web app project in netbeans to a new maven web app project in netbeans. Since my project was under the subversion repositories I need to merge my new created project with the committed versions of old project in the repository so as to keep the history still alive. How do I merge the two projects in subversion repository
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我从你的问题推断出你的旧项目(我们称之为项目 A)处于源代码控制之下,而你的新项目(项目 B)则不受源代码控制。如果确实如此,您有几个选择。
正如您在后续评论中建议的那样,将 B 作为 A 的子树导入。根据定义,您已经实现了维护 A 历史记录的目标(因为您没有更改 A)。请注意,执行此导入有两种主要方法:一次性导入和就地导入。您可以在此处阅读 Tortoise 手册中有关两者的详细信息,但是您可以从我整理的这张表开始来说明差异:
简而言之,一次性导入(通过 SVN >> Import 完成)听起来可以节省时间,但实际上它需要相同数量的步骤作为就地导入(通过
SVN>>Add
完成),后者更加灵活(由于表中的第 2 项)并且更适合任务(第 3、4 项)和 5)。您的问题暗示的另一种可能性是您想要在 B 的存储库中启动一个新项目(通过与上面相同的导入选项完成),然后您想要将 A 的树移动到 B 下面。这是一个简单的拖放操作-Windows 资源管理器中的拖放操作。但使用鼠标右键进行拖动,以便在目标上释放鼠标按钮时获得上下文菜单。然后选择
SVN 在此处移动版本控制项目
选项。此操作实际上会生成删除操作和添加操作,如果您随后在源目录和目标目录共有的父目录上打开提交对话框,您将会看到这一点。不过,Subversion 会隐式保留移动信息:提交后,从新位置查看日志并取消选中底部标记为停止复制/重命名
的框,您将看到完整的历史记录。I infer from your question that your old project (let's call this project A) is under source control and your new project (project B) is not. If that is indeed the case, you have a couple options.
As you suggest in your follow-up comment, import B as a subtree of A. By definition then you have achieved your goal of maintaining the history of A (because you have not changed A). Note that there are two principal ways to do this import: the one-shot import and the import-in-place. You can read details about both in the Tortoise manual here but you can start with this table I put together to illustrate the differences:
In a nutshell, the one-shot import (done via
SVN >> Import
) sounds like a time saver but in reality it takes the same number of steps as the import-in-place (done viaSVN >> Add
) and the latter is both more flexible (due to item 2 in the table) and more to the task (items 3, 4, and 5).Another possibility implied by your question is that you want to start a new project in the repository for B (done via the same import choices as above) and you then want to move the tree for A underneath B. This is a simple drag-and-drop operation in Windows Explorer. But use the right-mouse button to drag so that you get a context menu when you release the mouse button over your target. Then select the
SVN Move versioned item(s) here
choice. This action actually spawns both a delete action and an add action, as you will see if you then open the commit dialog on a parent common to both source and target directories. Subversion retains knowledge of the move implicitly, though: after you commit view the log from the new location and uncheck the box at the bottom labeledstop on copy/rename
you will see the complete history.