0

I did some serious stupidity with svn move and svn ci.

Old directory structure:

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

Desired directory structure:

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

Expected steps:

  • Move source/branch1/test_framework/ to source/test_framework/
  • Merge source/branch2/test_framework/ into source/test_framework/

How I started:

[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

What I should have done:

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

My Stupidity:

[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

Here, I looked up Google and StackOverflow and did the following fix suggested for the Item ... out of date error:

[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

Now I get stuck with this:

[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

Now how do I fix this conflict? Please note that the svn merge is not an issue, and is instead just an explanation point of how I reached here.

I'd appreciate answers that give the reasoning on what to do as well.

Edit - The solution I used to fix my issue (This is not ideal. The accepted answer is better):

  • svn status source/branch1/test_framework/ to list the files deleted during the svn move
  • svn revert source/branch1/test_framework/$FILE for each file listed above to undo the removal/deletion action of the svn move
  • svn delete source/test_framework/ to undo the copy action of the svn move followed by svn ci source/test_framework/ to check-in the deletion.
  • Do it correctly.
4

1 回答 1

1
  1. 签出一个新的工作副本,撤消错误的修订(svn merge -c-274232。),提交
  2. 从头开始做正确的事

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

于 2013-07-11T07:37:53.037 回答