Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renamed file, now SVN not allowing me to commit?

Tags:

commit

svn

I'm developing a ColdFusion website using Aptana. We're using SVN for version control.

I renamed a few files and am now trying to commit one of them, but I'm getting the following error:

'SVN Commit' has encountered a problem. org.apache.subversion.javahl.ClientException: Illegal target for the requested operation svn: Commit failed (details follow): svn: Cannot commit 'R:\myPath\My-New-File-Name.cfm' because it was moved from 'R:\myPath\My-Old-File-Name.cfm' which is not part of the commit; both sides of the move must be committed together 

This seems to indicate that I need to commit both the previous file (that was renamed) and the new renamed file together. How can I commit a file that no longer exists...?

like image 903
froadie Avatar asked Feb 05 '14 09:02

froadie


People also ask

How do I commit newly added files in svn?

You can also add files within a working copy simply by left-dragging and dropping them onto the commit dialog. If you add a file or folder by mistake, you can undo the addition before you commit using TortoiseSVN → Undo add....

How do I change a filename in svn?

In this case svn mv should work as follows: $ svn mv old_file_name new_file_name A new_file_name D old_file_name $ svn stat A + new_file_name > moved from old_file_name D old_file_name > moved to new_file_name $ svn commit Adding new_file_name Deleting old_file_name Committing transaction...

How do I revert to a previous commit in svn?

Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.


2 Answers

Commit the directory, not the file.

Think of a directory as a text file containing the list of files it contains, then you can see that to commit successfully, you need to update the directory itself so it can remove the old entry and add the new entry. This will show up in SVN as deleting the old and adding the new file (ie 2 changes to the directory, not 1 change to the file)

If only want to commit the 1 file, you will need to add the other changed files to an ignore list temporarily.

like image 150
gbjbaanb Avatar answered Sep 21 '22 05:09

gbjbaanb


Various clients seem to handle this better than others..

AnkhSVN for Visual Studio encounters this error and can't deal with it.

TortiseSVN (shell extension) works though - it knows to delete the old file and add the new one.

So if you're on Windows an easy way to work around this is to use TortiseSVN from Explorer to do a commit on the directory (which deletes the old file name and adds the new one).

like image 24
Ray Ackley Avatar answered Sep 23 '22 05:09

Ray Ackley