Renamed file, now SVN not allowing me to commit?

53,011

Solution 1

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.

Solution 2

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).

Solution 3

Add a file with old name and do commit, Then delete the file again do commit.

Solution 4

In eclipse with subversion, I was able to work around this confusing error by doing a Team->synchronize at a high enough level folder in the project that it encompassed both the old and new file names and locations. If you moved and renamed your files or if you can't figure out what precisely is going on, it can't hurt to synchronize at the very top level of your project.

When I did this, the old versions of the renamed files showed up in the synchronize view. Once I used "override and commit" on them, they disappeared again. At this point, the new ones will finally commit properly.

Solution 5

svn commit 'R:\myPath\My-New-File-Name.cfm' 'R:\myPath\My-Old-File-Name.cfm' -m "message"

works for me. You just also need to include the deleted file.

Share:
53,011
froadie
Author by

froadie

Updated on November 26, 2021

Comments

  • froadie
    froadie over 2 years

    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...?