0

I am not quite sure if I am weird or what, but it seems I cannot find a proper answer for renaming files in svn.

The official documentation assumes I am going to (out of my all worries of coding and maintenance) rename files using svn before I make changes!!!

Am I missing something or what? Can svn accept a renaming I did using the file system without forcing me to revert the old file and moving the new file I worked with to another folder before I can make (svn mv old_file new_file), after then only I can bring back the new file I worked on and then replace it back!

I am using SilkSVN version 1.8.13 on Windows.

2 Answers 2

3

Can svn accept a renaming I did using the file system

No. OS-level renaming will produce broken history (two unrelated file-actions - "file added" and "file deleted") in log without any relation between two files, contrary to properly moved|renamed file

>svn log -q -v intefaces.txt --stop-on-copy
------------------------------------------------------------------------
r5 | Badger | 2015-07-12 20:58:23 +0500 (Вс, 12 июл 2015)
Changed paths:
   A /trunk/API/intefaces.txt (from /trunk/inteface.txt:4)
...
Sign up to request clarification or add additional context in comments.

2 Comments

So the only way is to rename in svn first and then make changes in the IDE, right?
@Ghasan - yes, or "change SCM"
2

I don't know about SilkSVN, and I am pretty sure the command-line doesn't have this, but TortoiseSVN has a "repair move" feature that can be used to fix the situation where you forgot to use SVN to rename a file, and just did it using OS commands (or, if you had to use an external tool to upgrade/rename a file – I'm looking at you, Microsoft).

In TortoiseSVN, if you've renamed a file and SVN doesn't know yet, you can use "Check for Modifications" to see both a "missing" file and an "unversioned" file. Highlight both with a CTRL-Click, and then the context menu contains a "repair move" option that marks the file as renamed instead of an unversioned add/delete.

Note, even lacking this feature, you don't need to revert the old file, just temporarily rename/move the file you're working on back to its old location and then use svn move to put it back where you want it: SVN "repair move" from the command-line.

1 Comment

Man! I just cannot imagine that I could not think of it! I mean just renaming the new file with the old one using OS command, and the rename it back again using svn! Oh, my! Kudos!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.