سؤال

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

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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

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

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.

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.

For Visual Studio 2015, I tripped over a fix for Ankh SVN. In my case the error resulted from renaming a "Form1.cs" during development (and perhaps moving it). That caused issues with the old and new .resx files.

  • Highlight the project in the Solution Explorer to open the pending changes view window,
  • Choose File > Subversion > Pending changes
  • Uncheck the Path
  • Check the two or more files that subversion needs. If "new" one isn't in the list change its contents in a non-desturctive way so it will appear in the list.
  • Run commit.

Hope this works for you.

There is a chance that one of the files is renamed.

Look at the file names in the error and see if this matches with your files.

If the file names don't match, rename your file to the one in the error and commit all the files you wanted to commit. After this you can rename your file and commit again.

If things really get messed up, the simplest solution is to delete the folder from the repository and then add it back in its current form.

SVN Wipe and Replace:

  1. Copy the folder containing all of your changes to a temporary location.
  2. Use SVN Delete on the folder and then commit.
  3. Copy the backup copy back to your working copy and commit.

If you're using IntelliJ IDEA and make commit with TortoiseSVN, sometimes, it happens that the folder is not deleted by IDEA and Subversion make this error.

In that case, that means "please, don't commit a folder/file you marked as deleted"

sudo svn rm offendingfile --force

sudo svn commit -m ''

Done

For me, many of the other solutions were not working.

What finally did the trick was this:

  1. I made a manual backup copy of everything in my repository folder except for the .svn folder
  2. ...then reverted the repository folder
  3. ...then deleted everything except the .svn folder in the repository folder
  4. ...then copied the contents of the backup folder back into the repository folder
  5. ...then committed that.

Then, and only then, did the commit finally work for me.

TortiseSVN open the file in windows explorer. select the file,right click,use TortiseSVN->unversion and add to ignore list

then the file will get rid of the SVN,becomes normal file. thus you can do the operation to add the file to SVN,and submit it.

i use the solution solve to the issue.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top