tags:

views:

922

answers:

4

Can I rename a folder in Perforce from //depot/FooBar/ to //depot/Foobar/?

I've tried this by renaming from //depot/FooBar/ to //depot/Temp/ to //Depot/Foobar/ but the end result ends up the same as //depot/FooBar/.

A: 

I guess it treats files and folders the same.

For files: It depends (on whether you have a Windows or Unix server). We have this problem with our Windows perforce server (which versions our Java code), where very occasionally someone will check in a file with a case problem (this then causes compile errors because it's Java). The only way to fix this is to obliterate the file and resubmit it with the correct case.

Johan
+4  A: 

Once it is in Perforce, the case remains set. As mentioned by Johan you can obliterate, set the name up correctly, and add it in again. However, there is a slight gotcha....

If anyone else (running Windows) has already synced the wrong-cased version, then when they sync again the right one, it will not change the case on their PC. This is a peculiarity of the Windows file system acknowledging case but still being fundamentally case-independent.

If a number of users have synced, and it is not convenient to get them to remove-from-client too (and blasting the folders from their machines), then you can resort to a dark and dirty Perforce technique called "Checkpoint surgery". It's not for the fainthearted, but you do this:

  1. Stop your server, take a checkpoint.
  2. Using your favourite text editor that can handle multi-megabyte files, search & replace all occurances of the old case name with the new. You could of course use a script too.
  3. Replay your checkpoint file to recreate the Perforce database meta data.
  4. Restart your server.

This will affect all user client specs transparently, and so when they sync they will get the right case as if by magic.

It sounds hairy, but I've had to do it before and as long as you take care, backup, do a trial run etc, then all should be OK.

Greg Whitfield
Windows doesn't really care about filename case, but *remembers* it. One of my co-workers refers to this as "case-retentive". :-)
Graeme Perrow
I think the case-remembering may happen no matter what your platform. I know I've had that happen on Linux before, to my eventual chagrin when I tracked down the problem. I think perforce itself does a case-insensitive check for the path.
Caleb Huitt - cjhuitt
+1  A: 

I'm not sure about directories, but we've had this problem with files. To fix it, we have to delete the file, submit that change, then p4 add the file with the correct case and submit the second change. Once that's done, unix users who have sync'ed the incorrect-case file have to p4 sync, then physically delete the file (because p4 won't update the case) and then p4 sync -f the file.

Our server is on Windows, so that might make a difference.

Graeme Perrow
A: 

Maybe not needed anymore, but here's the official Perforce HowTo about chaning file cases on Windows and Unix: http://kb.perforce.com/UserTasks/ManagingFile..Changelists/ChangingFileCaseWindows

Hutaffe