tortoise svn mass rename files merge

情到浓时终转凉″ 提交于 2019-12-13 05:17:34

问题


I have a folder in where a co worker had to rename all files in it. The folder has about 12000 files which were renamed with a renaming tool. Now I have the problem that Tortoise SVN does not recognize the files as the names are different now. This leads to my question: can I tell subversion that the files were renamed so that it looks in the folders and looks for the matching files? Contents did not change, but only the names.

I know there is a way to tell tortoise that a file was renamed if you select both, the missing entry and the new file and choose "repair move". But this is only possible for two files. I have 12000 files and no one will rename them by hand. The file names changed only partly. e.g.: data.00001.house.txt -> data.house.txt

Any help would be appreciated. Greetings, Florian


回答1:


I think you have to re-visit you co-worker's rename tool. Hopefully it's a .bat file or something that can be modified.
Change it so that it properly uses the SVN MOVE command.

i.e. instead of:
mv <oldname> <newname>
use:
SVN MOVE <oldname> <newname>

You will notice that this isn't really a Tortoise solution, but a generic Subversion solution, using the Subversion command-line "SVN MOVE" command. see: http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.move.html

Test that on a small scale to ensure that it works. Then delete all of his bad files, revert his changes, re-run the new utility, check it in, and you're done.




回答2:


How were the files renamed? Here's a sort of command line description of the evil way:

copy %FILE% %DIR%
svn delete %FILE%
svn add %DIR%\%FILE%
svn commit -m"Moved %FILE% to %DIR."

In this method, the file is copies to a new location, and the old file is deleted and the new one added. The problem with this is that to Subversion the old deleted file has no relationship to the newly deleted one. It is similar to this:

svn delete --keep-local foo
svn add foo
svn commit -m"Deleted and added foo"

I deleted a file called foo (and kept the local copy), then added it back in. To Subversion, even though both foo files are in the same directory, and even have the same contents, they're two different files that don't share a common history.

What you want to make sure your rename tool is doing is:

svn move %FILE% %DIR%
svn commit -m"Moved %FILE% to %DIR"

How did your rename tool work? That's the $64,000 question. The best thing to do is take a log of one of the renamed files (with verbose mode, and make sure stop-on-copy is not set) and see if the history follows back to the old location and names.

If not, you will probably have to do the renaming over. This means undoing the initial rename, committing that change, and then redoing that renaming the correct way.

Use the command line tool, and don't depend upon third party tools.

Let's say that the renaming took place in revision 12345:

C> svn merge -c -12345 .

This will undo Change 12345

Now, you have to rename each file. I'm not a batch expert, but for each file, use svn move to do the rename.



来源:https://stackoverflow.com/questions/25978080/tortoise-svn-mass-rename-files-merge

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!