3

We use VisualStudio with SVN and VisualSVN.

I restructured the solution by moving (cut and paste/drag and drop) and renaming a lot of files.

Never heard a complaint from VisualSVN, now it is time to commit it refuses to do so:

Commit failed (details follow):
Error: Cannot commit 'C:\Sources\xxx' 'xx\Model\Model.cs' because it was moved to
'xxx\NewModel.cs' which is not part of the commit; both sides of the move must be committed together

That is correct neither file exists any longer at the given positions, and frankly I don't care.

I need SVN to store the solution as it is now. It is OK that I will not be able to trace change history for moved and/or copied files.

Is there a way to force the commit?

bahrep
  • 29,961
  • 12
  • 103
  • 150
k.c.
  • 1,755
  • 1
  • 29
  • 53
  • Do a commit at the root of the SVN repository. Then both sides of the move will be committed together. This may involve completely new "total" checkout. There's no other way. – Dialecticus Jul 31 '14 at 09:29
  • @Dialecticus That did not do the thrick – k.c. Jul 31 '14 at 09:32
  • FWIW the Agent SVN plug-in (for which I am the author) allows files to be moved/renamed inside of VS and those changes do get reflected in SVN. Agent SVN does this via the MS-SCCI interface (an interface it implements) so this is definitely possible. But the downside to using the MS-SCCI is each of those individual changes is committed at the time they are done and as such there is no concept of a final commit. – jussij Aug 08 '14 at 06:24

3 Answers3

1

It seems that you get the error because you commit only the part of the move action. Moves in Subversion consist of svn copy (to the new item location) followed by svn delete (of the original item), so both sides of the move must be committed in one revision together.

I suggest following these steps:

  1. Visual Studio | VisualSVN | Commit.... Make sure that both sides of the move you've performed are listed in "Changes made" list view and try to commit. Do you still get the same error?

  2. If the first step fails, go to Visual Studio | VisualSVN | Windows | Pending Changes. Right-click the root node of your solution / working copy and choose Commit.... Still getting the error?

  3. Go to Visual Studio | VisualSVN | Set Working Copy Root... and make sure that the working copy root points to the root of your solution's WC. Attempt to commit after this step.

bahrep
  • 29,961
  • 12
  • 103
  • 150
  • for point one: That list is longer than my leg, but no I don't think so, but I do get the error. Point Two: Yes, I do get the error, and when updating from the root, I did get some tree conflicts which I tried to resolve by using the files form my working copy. Point 3: Checking... – k.c. Jul 31 '14 at 09:54
  • Committed projects incrementally till only the one with the offending (missing) file references remained. Added dummy files for them, committed, deleted and committed again, successful commit. However, my question, is not yet answered. How to make SVN eat what you got, as it is on your machine. still +1 for helping – k.c. Jul 31 '14 at 10:22
  • @k.c. it's hard to tell what's going on without knowing exact actions you've performed and looking at `svn st -v` command's output (has to be run against the root of the working copy). – bahrep Jul 31 '14 at 11:04
  • @bharep That is the point. Neither do I. I spent two days restructuring my solution with V.S.. At the end of that process I expect to be able to commit what I have, update what can be updated, delete what is no longer found, create what is there and wasn't there in a previous version. As it stands now Visulal SVN and SVN is in my opinion not a viable version control option, because it let's me create a legal situation in V.S. (no complaints while in process) and at the end it refuses to commit – k.c. Aug 01 '14 at 09:23
1

I ran into this exact problem over the past week while refactoring some code and renaming numerous files. I was able to correct the problem as follows:

  1. I committed my project folders one at a time (at the folder level) to isolate the problem. In my case, all but two folders committed without errors.
  2. In the problematic folders, I committed the files individually. I now had a green dot next to every file, but the two folders were still yellow.
  3. I tried to commit the folder again. It gave me the same error, but now it just showed the files it was having an issue with in the dialog box.
  4. The files that were giving me a problem were files that had been deleted and not on my drive. I right clicked on each file and reverted it. This put the file back on my drive, even though it wasn't part of my project in VS.
  5. Lastly, I added the file back to the project in VS and then immediately deleted it and committed the project. Everything appears to be fixed now.

TL;DR -- If SVN thinks a file is part of your project, but the file is missing from you HDD, it will give you this error. Simply revert the file to get it back on your drive. To clean it up, add the file back into your project and then delete it within VS to get everything in sync.

Roger Rouse
  • 2,287
  • 2
  • 15
  • 10
-1

Please click refresh button first, after refresh in commit package Visual Studio will be included delete and rename rules, needed for SVN

UmAnusorn
  • 10,420
  • 10
  • 72
  • 100
Viacheslav
  • 1,054
  • 12
  • 16