SVN合并主干到分支删除文件

发布于 2024-12-20 03:21:43 字数 385 浏览 2 评论 0原文

我正在尝试做一些看似简单但存在问题的事情。

基本上,我有一个 svn 存储库,它有一个主干和一个从修订版 122 创建的分支。

我向分支添加了一个文件 (src/utils/foo.py),将其提交为修订版 128,一切都很好。

但是,在我的分支中已经有几次提交(即(123,124,125,126,127)到我想要的主干中。所以我做了类似的事情:

$ svn merge -r122:127 ^/projects/my_project/trunk/src/utils .
--- Merging r123 through r127 into '.':
D    foo.py

哎呀!它删除了我的文件!我做错了什么,这样就不会发生这种情况?

I am trying to do something seemingly simple, yet having problems.

Basically, I have an svn repo, it has a trunk and a branch which was created from revision 122.

I added a file (src/utils/foo.py) to the branch, committed it as revision 128, all good.

However, there have been several commits (namely (123,124,125,126,127) in to the trunk that I'd like in my branch. So I do something like:

$ svn merge -r122:127 ^/projects/my_project/trunk/src/utils .
--- Merging r123 through r127 into '.':
D    foo.py

Whoops! It deleted my file! What am I doing wrong so that this doesn't happen?

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

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

发布评论

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

评论(3

生生不灭 2024-12-27 03:21:43

它可能与拥有该文件的文件夹有关,而不是与文件本身有关。我相信大多数 SCM 工具都将文件夹视为文件,因为它们也会进行版本控制。您可能需要上一级以确保“utils”文件夹也被合并。

编辑:

再解释一下,文件夹“utils”记录了文件“foo.py”是它的子文件,因此即使foo.py存在于主干中,也不会合并更新的 utils 文件夹可能不会显示。

It may have more to do with the folder that owns the file, than the file itself. I believe most SCM tools treat folders like files in that they get versioned as well. You might need to go up one level to make sure that the "utils" folder gets merged over also.

Edit:

Just to explain a bit more, it is the folder "utils" that records that the file "foo.py" is a child of it, so even if foo.py exists in trunk, without merging the updated utils folder it may not display.

樱花坊 2024-12-27 03:21:43

首先,您是否在执行 svn merge 命令的正确目录中?其次,永远不要只合并 SVN 中的子文件夹。 使用即可

svn merge ... ^/projects/my_project/trunk 

只需在工作副本的根目录中 。这会更好,特别是与合并历史记录(svn:mergeinfo)相关。

First are you in the correct directory where you executed the svn merge command? Second never merge only subfolders in SVN. Just use

svn merge ... ^/projects/my_project/trunk 

into the root of your working copy. That will be better in particular in relationship with the merge history (svn:mergeinfo).

末が日狂欢 2024-12-27 03:21:43

啊!有人确实将分支合并到主干中,这将文件添加到主干中,但随后回滚了该提交,从主干中删除了该文件。感谢您的帮助。关于 svn merge 如何工作的好课。

Ah! Someone had indeed merged the branch into the trunk, which added the file to trunk, but then rolled back that commit, deleting the file from trunk. Thanks for the help. Good lesson in how svn merge works.

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