开发者

How to replace a directory in a SVN repository without breaking anything

开发者 https://www.devze.com 2023-02-24 10:49 出处:网络
I need to replace a directory in my SVN repository on the production server, but am not sure of the correct way to do this without breaking anything.The directory being replaced is a third-party modul

I need to replace a directory in my SVN repository on the production server, but am not sure of the correct way to do this without breaking anything. The directory being replaced is a third-party module revision that has been compl开发者_开发知识库etely restructured, so in order to upgrade cleanly I need to deleted the old directory/files and replace with the new directory and files. When I do this (using svn delete) the working copy becomes obstructed or in a state that prevents me from committing or adding the new, unversioned directory to the working copy. I've tried svn update, svn cleanup, as well as other UI (TortoiseSVN and Cornerstone) fix-it shortcuts, but can't seem to get things re-synced - that is without rolling back to a previous revision or checking out a new copy.

I believe that the target directory on both the local working copy and remote repo have to be deleted, the working copy updated, the new directory added to the working copy and then committed to the repo; but I am unsure of the specifics or any missing steps or subtleties that I may be missing. The module that I am upgrading is pretty vital to the site application, so I need to get this right the first time - as this is being made on the production server - and has to be done quickly. If someone could map the steps out clearly, I would really appreciate it.


To make this easier, you can do it in a way that creates a single "broken" revision where the directory doesn't exist.

  1. svn up to get your working copy up to date
  2. svn delete <directory> to get rid of the current directory
  3. svn commit -m 'Deleted old module'
  4. Copy in the new directory to the working copy
  5. svn add <directory> to add your new directory structure
  6. svn commit -m 'Added new module'

This question has details about how to use "Vendor Branches", which may prove to be a better solution for your situation.


It is straight-forward to do this using TortoiseSVN's RepoBrowser. Simply delete the old folder then drag and drop the new folder in.


If you really need the directory structure to be updated in a single commit, You might use WinMerge :

  1. compare the two trees recursively, using a SVN filter to avoid comparing.svn directories
  2. Remove the files and directories which don't exist in the new structure from your WC
  3. Add the files and directories which only exist in the new structure to your WC
  4. Replace all the files which exist in both structure with the new ones in your WC
  5. commit
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号