Xcode4 does not support Perforce?

xcode4 does not support perforce?

I am adding a repository in xcode4. Only subversion and git to choose from.

how to add perforce repository?

thanks.

+7
source share
4 answers

I put together a couple of Automator services that allow you to bind hotkeys for p4 edit / p4 add in the file that is currently opening in Xcode 4. This is not ideal, but it is superior to switching to a terminal or p4v.

https://github.com/jcohen/xcode4-perforce-services

+4
source

It is also useful to note that in the settings / behavior there is a setting for adding behavior to certain actions. One of them is the Unlock File, which can be associated with a shell script, as here:

#!/bin/sh RESULT=`/opt/local/bin/p4 edit ${1#file://localhost} 2>&1` SHRESULT=$? while [ $SHRESULT -ne 0 ] do SCRIPT="tell application \"XCode\" to display dialog \"$RESULT\" buttons {\"Try again\",\"Cancel\"} default button 1" osascript -e "$SCRIPT" if [ $? -ne 0 ] then break fi RESULT=`/opt/local/bin/p4 edit ${1#file://localhost} 2>&1` SHRESULT=$? done exit $SHRESULT 

To invoke p4 edit when the editor should start making changes.

This update has been updated to install a dialog box if the p4 file does not work. This will try again if you click "Try Again" and stop when you click "Cancel", which is especially useful if you happen to have your username expiring in the first case or not connected to your server in second place.

Unfortunately, it seems that the exit code has not been verified to verify that the unlock was successful, and it looks like Xcode is changing the file to r / w in this case, so be careful when you get an error message that you either get editing to succeed, or edit the file later.

Obviously this solves the problem of unlocking / editing files, but I find that I like to use p4v for sending anyway.

Multiple Customers / Workspaces

For those of you who can use multiple clients on the same machine (something we do more now, when we use streams with Perforce more often), it can be difficult to make sure that the correct client is used to work on the file you are editing .

For us, we found the easiest fix that uses P4CONFIG to denote a specific perforce configuration file. In our case, we usually use .p4config-<user/host> , so I can have .p4config-laptop-gaige and choose or check it, if necessary, not interfere with .p4config-desktop-gaige . Inside the .p4config file .p4config we install P4CLIENT , and this ensures that the p4 command knows which stream to use.

+8
source

Perforce support has been officially removed from Xcode 4. If they don’t add it back, you will have to invent something.

+3
source

The technique I mentioned in this question also works for Perforce. In fact, this was my initial use for DTerm.

Since Perforce support was severely compromised in Xcode 3.0, I use DTerm to check files and get their status for several years.

+1
source

All Articles