A sane way to rename a directory in subversion working copy

前端 未结 4 1359
Happy的楠姐
Happy的楠姐 2021-02-02 05:05

While somehow versed in VCS (regular svn, git and git-svn user) I can\'t seem to wrap my head around this peculiar SVN behavior.

Whenever I need to rename a directory in

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 05:55

    svn mv works for me:

    C:\svn\co>svn mv my_dir new_dir
    A         new_dir
    D         my_dir\New Text Document.txt
    D         my_dir
    
    
    C:\svn\co>svn commit -m foo
    Raderar             my_dir
    Lägger till         new_dir
    
    Arkiverade revision 2.
    
    C:\svn\co>
    

    Sorry for the Swedish output of svn.

    There must be something else that is wrong in your case.

    Edit:
    As pointed out in the comments by Lloeki

    To reproduce the behavior you also need to update and commit a file contained in the folder, but not update the folder itself.

    file commit creates a new rev n on the repo, but local metadata is not updated (as it has always be, see svn log after any commit) , thus dir metadata is at rev n-1. It follows that svn won't commit because of the metadata diff, and it won't update because there's indeed a conflict on the dir: update metadata vs delete.

    The behavior is "expected" and the "solution" is to update the working copy before issuing the svn rename command.

提交回复
热议问题