Showing posts with label Changing. Show all posts
Showing posts with label Changing. Show all posts

Saturday, 18 December 2010

Changing File Case

Change the case of a file on a Perforce Server.

The solution to changing the case of files depends on the native case-handling behavior of your platform. For platforms with case-sensitive file systems (for example, Linux), the case change operation is a straightforward rename. On Windows, additional steps have to be taken to account for the fact that the NTFS file system largely ignores case differences; it is case-aware, but case-insensitive.

Because Windows uses a case-insensitive file system, references to files that differ only by case are ignored. In order to get the Perforce Server to change the case of a file on a Windows Server, the file must first be deleted and then re-added to Perforce using the correct case. Additionally, the internal Perforce "have list" references to the old case name must be eliminated by removing the file from case-insensitive workspaces and then re-syncing the file using the correct case.

Windows Example

In this example, file "foo" has three revisions and you want to change the file name to use all upper-case, from "foo" to "FOO".

Delete the existing file p4 delete foop4 submitRecreate the file in your local file system with the correct case. Then, use the p4 sync command to re-create the file in your workspace using the correct case. p4 sync FOO#3Remove the internal "have list" reference. The p4 flush command (sync -k, in recent versions) removes the have list reference without removing the file from your workspace. p4 flush FOO#noneRe-add the file in the correct case. As with the sync command, the p4 add command uses the case of the file argument provided at the command line, so it is important to provide the correct case. p4 add FOOp4 submit

Notes

To obtain the newly case-changed file, all users who use workspaces on case-insenstive file systems (such as Windows NTFS or MacOS X HFS) must remove the old file from their workspace and then re-sync the renamed file with the correct case to replace it in their workspace.

For the example above, this means:

p4 sync foo#none
p4 sync FOO#head

On Unix, simply integrate the file and delete the original file.

Unix example

Use p4 integrate to change the old name to the new name. $ p4 integrate kiwi.txt Kiwi.txt//depot/Kiwi.txt#1 - branch/sync from //depot/kiwi.txt#1,#9Delete the original name. $ p4 delete kiwi.txt//depot/kiwi.txt#9 - opened for deleteSubmit the changes. $ p4 submitChange 12681 created with 2 open file(s).Submitting change 12681.Locking 2 files ...branch //depot/Kiwi.txt#1delete //depot/kiwi.txt#10Change 12681 submitted.

Verify the results

Use the p4 files command to check that the Perforce metadata is in the proper case.

$ p4 files Kiwi.txt//depot/Kiwi.txt#1 - branch change 12681 (text)

Note that "Kiwi.txt" is now in the proper case.

11 users have rated this article 2.7 out of 5

View the original article here

Saturday, 6 November 2010

Changing the Windows TEMP Directory

I have been hitting the Windows path length limit of 260 characters on my local workspace, but it is not the workspace root that is causing the problem. Instead, the error message indicates that the temporary file could not be created.


As noted in KB article #978, you can avoid most path length issues by moving the local workspace root to a shorter path. However this does not affect the current location of the Windows TEMP directory, typically located on the path: C:\Users and Documents\{user name}\local settings\tempBefore adding the user name this is a 43 character path. Adding a user name of 8 letters pushes this over 50 characters. The location of the temporary file directory is controlled by the operating system, as noted in the Perforce Command Reference. To set the Windows temporary directory location for a current DOS command prompt, you can to use the "set" command from the command prompt. For example: set TMP=C:\temp set TEMP=%TMP% Note: The temporary directory must already exist. The first command sets the value for %TMP%. The second verifies that the %TEMP% value is the same as %TMP% -- a mismatch of those two values can cause a variety of problems for anything that uses the temporary directory. To permanently set the temporary directory for a Windows user account, go to Control Panel->System->Advanced, and enter the "Environment Variables" dialog window to find and change the TEMP and TMP variable settings in the "User variables".

View the original article here