AnkhSVN - Renaming (changing its case) a file inside Visual Studio
Asked Answered
S

4

12

When I try to rename the file Class1.cs to class1.cs inside VS and then try to commit the project via ankhSVN I get two errors:

[...\Class1.cs] is already under version control.


The commit processing can't commit [...\Class1.cs], because it is not managed by Subversion. Maybe you should refresh the status after applying changes with another client?

I then deleted class1.cs, added a new class1.cs, tried to commit it but received the same errors. How can I get around this problem so I can change the case and still be able to commit? I know that Windows is case insesitive but shouldn't there still be a (easy) way to do this?

After playing a little more with ankhSVN and then trying to commit the file with its original name (so i at least have it back in version control) I got:

An internal error occured. Commit failed (details follow):  Cannot commit: '[...]\Class1.cs' because it was moved to '[...]\class1.cs' which is not part of the commit; both sides of the move must be committed together

SharpSvn.SvnIllegalTargetException...

I'm using

  • Windows 7 64
  • Visual Studio 2012
  • TortoiseSVN 1.8.4
  • ankhSVN 2.5.12266.473
Safir answered 20/1, 2014 at 16:38 Comment(0)
W
12

You can do this with in Visual Studio + ankhSVN.

  1. Copy/Paste the file you want to rename and paste it in the same folder

  2. Rename the file from "Copy Of xxxx" to the desired new name.

  3. Delete the old file

  4. right click the folder both files were in and perform the svn commit operation on the entire folder.

Thats it!

Western answered 22/2, 2014 at 17:17 Comment(3)
Simply saying, the only thing you have to do is to commit the parent folder from the Windows Explorer. Everything else, like renaming and copying can be done from the VS IDE.Toluene
This is totally broken. How can VS and ankhSVN not support renaming files in the IDE...Coelho
@user1422843 I think this is more of svn issue. #17280447Western
S
3

I fixed it with the following steps. I still hope there is an easier way.

  • I made sure no class1.cs or Class1.cs was part of the project anymore using VS.
  • Now inside Windows Explorer:
    • I commited Class1.cs using TortoiseSVN (because I deleted it, see question)
    • I used the Rename Option from TortoiseSVN to name it class1.cs
    • I commited class1.cs using TortoiseSVN
  • Now inside VS I showed all files, included class1.cs in the project and commited the project via ankhSVN
Safir answered 27/1, 2014 at 17:33 Comment(0)
V
2

I had this same issue and I went into the file folder where the issue was occurring and right clicked on the file and said TortoiseSVN --> add. Then a dialog box came up saying the file already exists and would I like to

1) Case has changed 2) Add the file (cause problems with windows)

I of course picked #1 and then refreshed the status in VS and it fixed the issue. I then committed the changes and I was back to normal.

Victoria answered 29/5, 2014 at 16:43 Comment(1)
This solution solved my problem! After doing first step, the blue icon changed to yellow and then I could commit the new file. Thanks!.Naissant
A
0

In Windows Explorer, navigate to the folder where the files where originally located (before they were moved/renamed)

Right click in the folder and access your Repo browser from the Subversion menu.

Drag and drop the original files from the Repo back into your project folder.

In Visual Studio, open "Working Copy Explorer" and navigate to the directory where you just dragged and dropped the files.

You should see red "x"s next to the name of the files indicating that they have been deleted.

Select all the files and right-click on then, then choose "Add to Pending Changes"

After that you should be able to commit your changes.

Arguseyed answered 2/10, 2015 at 0:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.