svn:如何将两个文件夹合并为一个?

发布于 2024-12-09 16:10:17 字数 1002 浏览 0 评论 0原文

这个问题听起来很简单,但我就是不明白。 如何将两个文件夹合并为一个?

假设我有这个 Maven 结构:

module1
  - src/main/java
      - com.app.func1
           - file1
      - com.app.func1.some2
           - file3
           - file4

module2
  - src/main/java
      - com.app.func1
           - file1
           - file111
      - com.app.func1.some2
           - file333
           - file6

我想将整个 src/main/java 从 module2 合并到 module1

合并后应该如下所示:

module1
  - src/main/java
      - com.app.func1
           - file1 // it would be nice if the tool would let me visually merge this item
           - file111
      - com.app.func1.some2
           - file3
           - file333
           - file4
           - file6

两个模块都已经在版本控制之下,我不想丢失历史记录。

如果有人能帮助我那就太好了。

我已经尝试过 Eclipse subversive/subclipse 和 Tortoise SVN 但我做得不对。

大多数时候我会收到一些错误消息,例如 module1 中已存在文件夹 src。是的,但实际上我并不关心文件夹,它们应该像在 Windows 上一样集成。 其他时候,通过合并,模块 1 中的所有文件都将被删除并被模块 2 中的文件覆盖。

问候

the problem sounds simple, but I just don't get it right.
How can I merge two folders into one?

Let's say I have this maven structure:

module1
  - src/main/java
      - com.app.func1
           - file1
      - com.app.func1.some2
           - file3
           - file4

module2
  - src/main/java
      - com.app.func1
           - file1
           - file111
      - com.app.func1.some2
           - file333
           - file6

I would like to merge the whole src/main/java from module2 into module1

After the merge it should look like this:

module1
  - src/main/java
      - com.app.func1
           - file1 // it would be nice if the tool would let me visually merge this item
           - file111
      - com.app.func1.some2
           - file3
           - file333
           - file4
           - file6

Both modules are already under version control and I don't want to loose the history.

It would be nice if someone could help me.

I've already tried Eclipse subversive/subclipse und Tortoise SVN but I don't do it right.

Most off the time I get some error message like folder src already exists in module1. That is right, but I actually don't care about the folders, they should be integrated like on windows.
Other times through the merge, all the files from module1 are deleted and overwritten with the files from module2.

Regards

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

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

发布评论

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

评论(3

陌生 2024-12-16 16:10:17

该脚本在 http://jv-ration.com/2014 上进行了描述/01/merge-svn-directories/ 有点类似。您只需跳过步骤 #3,该步骤会从目标文件夹(在您的情况下为模块 1)中删除文件。

执行脚本后,您可以使用任何 SVN 工具来查看已更改文件的差异。

The script, which is described on http://jv-ration.com/2014/01/merge-svn-directories/ does somewhat similar. You just need to skip step #3, which deletes files from the target folder (in your case, module 1).

After executions of the script, you can use any of SVN tooling to review differences of changed files.

染墨丶若流云 2024-12-16 16:10:17

我认为您必须为每个文件执行 svn rename 。您可以编写采用 svn list 输出的脚本来帮助实现自动化。不过,您不会让它合并具有相同名称的文件:您必须手动执行这些操作。

I think you're going to have to do a svn rename for each file. You could do script that takes the output of svn list to help automate it. You're not going to get it to merge files with the same name though: you'll have to do those manually.

花间憩 2024-12-16 16:10:17

看来这个愚蠢的问题没有简单的解决方案。

作为解决方法,我在 Java 透视图中使用 eclipse 移动了所有源代码。

标记 com.app.func1 以及 src/main/java (maven) 下的所有文件夹,用鼠标移动到 module1 src/main/java 或使用 Refactor ->; Move

Eclipse 会自动做正确的事情,它使用 svn move 而不是愚蠢的移动,因此历史记录不会被删除。不幸的是,您无法移动非 java 文件夹,因为您会收到上述错误(文件夹已存在)。

提示:两个模块必须已处于版本控制之下,并且必须安装一些 SVN 插件,否则您将丢失所有历史记录条目。

module2
- src/main/java
  + com.app.func1
  + com.app.func1.some2

It looks like there is no easy solution for this silly problem.

As a workaround I moved all my sources with eclipse in the Java perspective.

Mark com.app.func1 and all the folders under src/main/java (maven) and move them with the mouse to module1 src/main/java or use Refactor -> Move

Eclipse automatically does the right thing, it uses svn move and not dumb moving, so the history will not be deleted. Unfortunately you can't move the non java folders because you'll get the error mentioned above (folder already exists ).

Tip: Both modules must already stay under version control and some SVN plugin must be installed otherwise you'll lose all the history entries.

module2
- src/main/java
  + com.app.func1
  + com.app.func1.some2
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文