How to show new files in Perforce workspace?
When I add new files to my project which is managed by Perforce, how can I get a list of the new files I've added (the ones Perforce does 开发者_开发知识库not know about yet) so I can make sure I don't miss any in my changeset?
Something like 'svn status | grep ^\?' or 'git status' to show the unstaged, unknown files.
Thanks! -Casey
Find the similar question on SO and check the other answers and comments too. There is no direct command available from command-line. But you can use a powershell script or a GUI for it.
The best answer is provided in the similar question linked to by Teja. However, if you want an easy command line solution that deals specifically with added files, you can do the following
find directory -type f | p4 -x- add
for normal files, and
find directory -type l | p4 -x- add
for links. (Letter 'el', not 'one' in above command)
Perforce simply refuses to add any files that are already in version control. The only problem is that this adds everything, including binary files.
For P4V, right-click on a folder in the workspace tree and click "Find File...". In "All or part of a file name", type "*.cs". Then sort by filetype - new files will have filetype "none".
Unfortunately there doesn't seem to be a way to apply multiple filters, e.g., "*.cs; *.aspx". So you have to filter one filetype at a time. Also, you have to be patient if there are thousands of files - the sorting mechanism won't work properly until the asynchronous find process has completed.
(The "Reconcile Offline Work..." option isn't working for me. I'm using P4V June 2009.)
You might take advantage of the p4 files command
find . -type f | xargs p4 files 2>&1 | grep 'no such file(s)'
You could even filter on file type like this.
find . -type f | xargs p4 files 2>&1 | grep 'no such file(s)' | grep 'cpp'
Here's a unix one liner using find and p4, fstat and awk that saved my bacon.
How to find untracked files in a Perforce tree? (analogue of svn status)
The perforce "reconcile" command with the "add files" and "preview" options will show new, un-added files, without adding them:
p4 rec -an
精彩评论