The p4v Perforce GUI client has an 'Actions > Remove from Workspace' menu command which removes all files from the workspace that are under version control and were not opened for edit or delete.
This functionality only seems to be available from the GUI client, I can't find any corresponding command in the ever growing list shown by p4 help commands.
I thought of using p4 where, p4 files and some list filtering, but that doesn't seem trivial, so before I go about creating a script, does anyone have a better idea ?
Specifying a revision of either #none or #0 will remove the files:
p4 sync //depot/project/...#none
p4 sync //depot/project/...#0
Use the -f switch to force removal of the files even if they are writeable (it won't affect files that are checked out, however):
p4 sync -f //depot/project/...#0
p4 sync ...#none
The easy way to find GUI equivalent commands (p4 CLI commands)
is to look at log tab in P4V. When we take any action on P4V GUI,
the "log" tab shows the corresponding P4 CLI command being executed.
Related
Whenever I run any go command at all (other than go help) the output is this:
mkdir C:\Users\LUCAS_~1\AppData\Local\Temp\go-build268335003: The file or
directory is corrupted and unreadable.
I'm not sure why this is happening, I've tried restarting, and that temporarily fixes it, but then after a couple of commands are executed, this starts happening again. I'm not sure if this will help, but my username is not LUCAS_~1 it's Lucas_000. Also, I've checked my Temp folder, and there doesn't seem to be anything named "go-build268335003".
Any help would be appreciated, thanks!
My first guess (confirmed in the comments) is that the TEMP environment variable is set to a DOS 8.3 path, truncating the user name using the DOS rules. How this came to be, I have no idea.
Fixing the problem is simple: Change TEMP to the full path.
The easy way is to open a command prompt and run the following:
setx TEMP C:\Users\LUCAS_000\AppData\Local\Temp
The slightly harder (but clearer) way (for Windows 8) is to follow the following sequence:
Start -> All Apps -> Control panel -> System ->
Advanced System Settings -> Advanced -> Environment variables
I wish to run a batch file either in START commit or PRE commit via TortoiseSVN hook scripts. No tests I have done has worked.
I have created a batch file (svnadd.bat) that just writes a message to a text file for now, so I know it fired. However, the batch file does not appear to run as the message does not get written.
echo YES>C:\Temp\commit.txt
Here is my hook setup.
My process. Right click on a folder which is under svn version control and select SVN Commit. The commit dialog shows, however, the batch file does not execute.
All svn software, repositories and folder/file structure under svn control reside on the same computer/drive.
As per the screen shot, I also tried adding cmd.exe to the front of the command line as
C:\windows\system32\cmd.exe /c C:\Tools\SVN\svnadd.bat
I config it like this. It is successful.
post_commit_hook.bat:
echo Hello World >file.txt
After commit, file.txt will be save to
E:\SVN\XXX\branches\autoCommit
#lazybadger's comment provides the answer in that the "path" needs to be at the highest working copy path. For me, this is C:\Projects.
Once I set C:\Projects as the path, the script hook ran.
You can try and use team city, if you want certain scripts to be executed on SVN events (like SVN Commit). Though TeamCity is mainly used as a build server, I think it can do what you desire.
Not long ago I found out a precious thing which comes with the git install:
http://git-scm.com/download/win
From git's bin folder on the command line you have almost a linux console available. Commands like curl, touch, kill, ssh, grep and lots of others. The problem is that when you move out of the bin folder, of course they become unavailable. Is it possible somehow to make these commands available globally from the windows command line?
Use this one Git Shell from Github
Has some cool git features in it, much better than default windows command prompt.
Few good points are:
Tab completion
Prompt for current branch
Colors highlighting
You simply add the full path to you "bin" folder (e.g. c:\git\bin\) into Windows "PATH" environmental variable.
As opposed to repeating how to do that here, plenty of help on the web.
http://www.computerhope.com/issues/ch000549.htm
Note: you may need to close and re-open the command window you are in if you add through the control panel.
IF I have a large changeset and want to be able to compare all changes before checking them in, is there a faster way than manually clicking compare to latest on every file? I have something like 900 files I changed, and that seems veryinefficient. There has to be a way to open all files in compare and be able to click close or ignore on each file one by one.
Best way to compare large changeset vs existing code?
Try this:
Open a Visual Studio Command Prompt (All Programs | Visual studio | Visual Studio Tools | Developer Command Prompt
(this is just a normal command prompt but with some extra env variables set, and with the visual studio tools in your path).
use the cd command to switch directory to the root directory that your project is in on your local disk that you want to compare: example: cd \MyProjects\TheProject
execute this command:
tf folderdiff . $/The/Tfs/Folder/Path/To/Corresponding/ProjectDir/On/Server /recursive /view:different
(there is a space between the "folderdiff" and the ".", and another space between the "." and the $/ The "." just says "use the current local path (you should be sitting on it). Being on the current path also gives the TFS command the context that it needs so that it knows how to connect to your TFS server, and which team project and collection to use.
This question already has answers here:
xcode4 doesn't support Perforce?
(4 answers)
Closed 2 years ago.
I'd like to setup a macro in XCode 4 to checkout the current file from Perforce. How can I do this? I do not have perforce integrated with my project and do not wish to do so. This is pretty easy in Visual Studio but I don't know the XCode equivalent.
Just came across this at Perforce.com as their means of making this work. I tried it, and it's pretty good.
http://answers.perforce.com/articles/KB/2997
As per the comment, it works in Xcode 5 as well.
And now it's tested and working in Xcode 6!
EDIT:
If that doesn't work, and you're using OS X Mavericks, this guy fixed the script to keep working. Just make sure the script references p4 properly. I had to change it from /usr/local/bin/p4 to /usr/bin/p4.
http://forums.perforce.com/index.php?/topic/2830-xcode-501-x-mavericks-perforce-integration-not-working/#entry11319
Make sure that the 'p4' command line tool is installed in '/usr/local/bin/'.
Verify that your Perforce environment variables are configured correctly. I use a 'perforce.rc' file at the root of every client workspacewith the name of the client (P4CLIENT)and port (P4PORT). Don't forget about P4USER, P4PASSWD, P4CONFIG, etc...
Create the following script in your ~/bin folder and make sure the permissions are set so it is executable (755 should work).
Go to the Preferences in Xcode and select "behaviors".
Scroll down to "Unlock file"
Scroll down some more and select the checkbox next to "Run"
Choose "Choose Script..." and point it to the following script:
xcodeunlock.sh
#!/bin/bash
# Xcode4 doesn't setup the environment
source ~/.bashrc
# Delete the URL part from the file passed in
fn=${BASH_ARGV#file://localhost}
echo "fn=" $fn
if [ -a ${fn} ]; then
res=$(/usr/local/bin/p4 edit ${fn})
# TODO: Report the status back to the user in Xcode
# This output goes to the console.
echo $res
else
echo "FnF" ${fn}
fi
Once this is set up correctly, unlocking a file in Xcode should run this script and attempt to checkout the file. Unfortunately any output goes to '/var/log/system.log'. I'm not sure how to notify Xcode 4 of a failure in this script.
It's maddening trying to get XCode to work with Perforce. Here is a solution I came up with that is:
Quick to get set up
Easy to burn into your muscle-memory so you don't have to think to check files out
Doesn't require any mousing at all
One-time setup as follows:
Download and install the free "DTerm" app from Decimus Software.
Make sure you have the Perforce command-line utility installed. Type "p4" at a Terminal window prompt, and see if it recognizes this command. If not, you need to go to Perforce's website and find and download what they currently call "The Perforce Command-Line Client (P4)". There's no installer; just save it from your browser right into /usr/bin (or whatever) and do a chmod +x on it. For official setup notes, and if you need to do any custom environmental variable tricks, please see this tech note.
Once you've done this, let's say you are in XCode and you are viewing a source code file that you want to check out. Here's the rigamarole:
Have the file showing in the active XCode editor
Hit Shift Command Enter to get a DTerm window
Type p4 edit and then hit Shift Command V to paste in the filename of the active file, and hit return
Perforce checks the file out and DTerm shows you the status/errors.
Hit 'escape' to dismiss the DTerm window
Begin making your changes to the file in XCode. XCode may (erroneously) say that the file is read-only, because it's dumb and isn't aware that it's been made from read-only to read-write, so you have to hit Allow Editing. I didn't trust this at first and double-checked it a few times, but now I have blind faith that it's doing the right thing.
I haven't set this up in a while, so please let me know if you run into any glitches and I'll update my info here to make it as painless as possible. But otherwise, this is the best solution I've found.