修复了部分提交 Subversion svn move 命令导致的树冲突



我对svn move做了一些严重的愚蠢行为,svn ci.

旧目录结构:

source/branch1/test_framework/
source/branch2/test_framework/

所需的目录结构:

source/branch1/
source/branch2/
source/test_framework/ <-- This is a merge of the 2

预期步骤:

  • 将源/分支1/test_framework/移动到源/test_framework/
  • 将源代码/分支2/test_framework/合并到源代码/test_framework/

我是如何开始的:

[dev@bld Prod1]$ svn move source/branch1/test_framework/ source/test_framework/
A         source/test_framework
D         source/branch1/test_framework/main.sh
D         source/branch1/test_framework

我应该做什么:

[dev@bld Prod1]$ svn ci source/test_framework/ source/branch1/test_framework/ -m "Move test framework to top level."

我的愚蠢

[dev@bld Prod1]$ svn ci source/test_framework/ -m "Move test framework to top level."
Authentication realm: <http://localhost:8443> UNIX/LDAP User Account
Password for 'dev':
Adding         source/test_framework
Committed revision 274232.
[dev@bld Prod1]$ svn ci source/branch1/test_framework/ -m "Move test framework to top level."
Authentication realm: <http://localhost:8443> UNIX/LDAP User Account
Password for 'dev':
Deleting       source/branch1/test_framework
svn: Commit failed (details follow):
svn: Item '/repo/CoreApps/Prod1/source/branch1/test_framework' is out of date

在这里,我查找了Google和StackOverflow,并为Item ... out of date错误进行了以下修复建议:

[dev@bld Prod1]$ svn update
Authentication realm: <http://localhost:8443> UNIX/LDAP User Account
Password for 'dev':
   C source/branch1/test_framework
At revision 274233.
Summary of conflicts:
  Tree conflicts: 1

现在我被这个困住了:

[dev@bld Prod1]$ svn ci source/branch1/test_framework/ -m "Move test framework to top level."
Authentication realm: <http://localhost:8443> UNIX/LDAP User Account
Password for 'dev':
svn: Commit failed (details follow):
svn: Aborting commit: '/repo/CoreApps/Prod1/source/branch1/test_framework' remains in tree-conflict

现在如何解决此冲突?请注意,svn merge不是问题,而只是我如何到达这里的解释点。

我希望得到答案

,这些答案也给出了该怎么做的理由。

编辑 - 我用来解决问题的解决方案(这并不理想。接受的答案更好(:

  • svn status source/branch1/test_framework/列出svn move期间删除的文件
  • svn revert source/branch1/test_framework/$FILE上面列出的每个文件以撤消svn move的移除/删除操作
  • svn delete source/test_framework/撤消svn move的复制操作,然后svn ci source/test_framework/签入删除。
  • 正确执行。
  1. 签出新的工作副本,撤消错误的修订(SVN merge -C-274232 .(,提交
  2. 从头开始

这是 Subversion 中的一种撤消/重做功能,一种整理由错误提交引起的仓库混乱状态的通用方法,当顶部没有完成很多提交并且混乱的提交没有太多的智力工作时(这正是您的情况,提交是一个简单的svn mv(。所以基本上我建议盲目地回滚更改,甚至不尝试理解混乱的状态(并节省时间(,然后正确地重复svn mv

最新更新