“Phantom” directories in an SVN repository

后端 未结 7 2585
没有蜡笔的小新
没有蜡笔的小新 2021-02-18 18:13

I\'ve somehow managed to get an SVN repository into a bad state. I\'ve moved a directory and now I can\'t commit it in its new location.

As far as svn status

7条回答
  •  醉梦人生
    2021-02-18 18:50

    It looks to me like type was created by some Subversion-aware copy command, then moved into the current directory using a Subversion-unaware copy. In my experience, this sort of thing typically occurs when package refactoring operations have been chained together in Eclipse without commits in between. Typically, Subversion doesn't handle it well when you copy/move a locally copied/moved file or folder, although I think version 1.5 may handle it better.

    To avoid this in the future, commit between such steps. If you'd like to hide the intervening commits then I'd recommend doing the multi-step refactoring on a branch and then merging the changes back into the mainline in that single commit you were after.

    If it's not too much work, then I'd recommend getting back to a clean working copy and redoing your changes, committing after each step. If you're happy to lose the history, i.e. allowing the new IntegerType.java to not be linked at all to the old IntegerType.java, then you could take the approach suggested by BCS:

    • Move your changed files into some temporary location, stripping out any .svn directories
    • Update your working copy into a clean working state
    • Copy your changes back to where you want them to be
    • Commit the resulting working copy

提交回复
热议问题