Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN "repair move" from the command-line

Tags:

svn

My IDE doesn't know that I use Subversion, and any time I rename a class (Java) it renames the file without notifying the version control system. I would of course like the file's history to be retained. I understand that in TortoiseSVN there is an option called "repair move" that fixes the move, but that's not an option since I'm on Ubuntu. Is there a way to repair the move from the command-line?

like image 408
Joey Marianer Avatar asked Jan 21 '11 21:01

Joey Marianer


People also ask

How do I move files in SVN without losing history?

If you right-drag the folder and use "SVN move versioned item(s) here", then you keep the history. Even the history of the files within the folder.

How do I change a filename in SVN?

Renaming a file. Normally you can just use SVN Rename on the context menu. This is analogous to the Move command described in the Moving or Copying a file recipe. It is almost as if you are doing two separate steps: an Add operation with the new name and a Delete operation of the old name.


1 Answers

If you remember the old name/location of the file:

mv new-filename old-filename
svn mv old-filename new-filename

You, of course, need the Subversion command-line client installed, which you probably have. If not, sudo aptitude install subversion subversion-client should do the trick.

Per your comment, no, I don't know that there is an easier way than this. If you're not sure what your old filename was, svn stat may give you a hint.

like image 121
Andrew Avatar answered Sep 21 '22 19:09

Andrew