How do I find if a file is managed by perforce?
I tried
p4 status myfile
but I am getting
myfile - reconcile to add //repo/myfile
Another way to read the message you're getting is "this file is not managed by Perforce; run reconcile to add it". So you're running the right command; just interpret "reconcile to add" as "this file has not yet been added".
Another option is "p4 files myfile", which will return "no such file" if the file is not in Perforce, and will return information about the depot file if it is. Almost any Perforce command that reports file information can be used to determine whether a specific file is managed by Perforce, since they will all return something along those lines if it is not.
Related
I have a changelist where I've deleted a few files after consolidating their functionality. P4v errors when trying to shelve the removed files with the message "The system cannot find the file specified". (Hey perforce, that's kinda the point).
Is there any way to shelve this as a "pending deletion"? Keeping these files around would cause errors in my code. Even making them blank is a bit sketchy.
Open it for delete instead of edit. This is p4 delete at the command line, or "Mark for Delete" in P4V. (If it's currently open for edit, you might need to revert it first and then open it for delete instead.)
I'm trying to do some customizations for P4V using P4JsApi and I can not figure out how to read workspace file content, any suggestions ?
(P4JsApi supports "p4 print" command but it seems to be only for depot files; "p4 print" + "p4 diff" is a way to get workspace file content, but it is complex and seems not suitable for new(add) file)
There is no direct way to do this now with P4JsApi, but the pending P4V release may contain a command to print workspace file content just as "p4 print".
I have a few files that have been edited by an external IDE, I forgot to Check Out the files before making the changes however when I look at the files through P4V the files have changed but the indicator for the file itself shows as nothing has changed. How can I ensure my changes are committed without loosing what I have done?
One way I was thinking was to making a copy of the file, revert, check out, copy content or replace file.
That is OK with a few files but what happens when you have done so with hundreds of files?
The "check out" command doesn't modify the local file, so you can just do that on its own without having to make a backup copy of the file first. (What you want to avoid doing is "get latest", although if the local files are writable, Perforce will automatically balk at updating them by default because of this exact situation.)
If you have lots of files that might or might not have been modified in different ways, use Actions > Reconcile Offline Work, or "p4 reconcile" from the command line. This will find the locally modified files and open them for the appropriate action.
The P4V way to do this is called "Reconcile Offline Work": http://www.perforce.com/perforce/doc.current/manuals/p4v/Offline.html
Or, at the command line, you can use 'p4 reconcile': http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_reconcile.html
With Perforce, I have the following situation:
Created a new file foo.txt in client client_a, opened it for add
Shelved foo.txt in client_a, unshelved it in client_b
Now foo.txt is open for add in client_b
Submit foo.txt in client_a
Now my question concerns how I can cleanup foo.txt in client_b. Maybe it has a one line change from the depot version that I'd like to keep. Ideally I'd like to do a resolve operation against the newly checked in file, but I'm not allowed to do this because it's open for add.
Now I have this file foo.txt#1 - add change default in my client.
I can't reopen the file ('nothing changed'), I can't diff it vs the depot ('file not open for edit'), I can't resolve it against the depot ('no files to resolve'), I can't open it for edit ('can't edit, already opened for add').
Is there any way to make perforce reopen this as edit instead of add? I know I can copy it to a temp file, revert, reopen for add, and then recopy the temp file back over, but this seems rather unelegant. Is there any command that can do what I want, or is there a good reason I'm not seeing why it's disallowed?
Only slightly more elegant than the comment in your last paragraph, but you should be able to:
Revert foo.txt in client_b. Since it was marked for add the file will remain on the disk with no changes
Sync foo.txt with -k. This makes the server think you have the latest revision without modifying your local file.
Check out foo.txt for edit. Diff'ing against the have revision should show the changes.
Submit your changes.
Sometimes I "Mark for Add" and add files to Perforce which I actually didn't want Perforce to worry about.
Is there a way to revert it so it just goes back to showing in P4V as an "untracked" item?
See my example:
I've added mil.ico and mil3.ico by mistake. I just want them to go back to looking like test.ico, ie. ignored by Perforce:
Even if I save a copy of the files, then delete, then put them back (all of which is a serious bore), P4V still knows they have a history and marks them as shown:
I just want Perforce to leave a file alone when I tell it to.
If you want to remove the last traces of the files from perforce, your only chance is through p4 obliterate. This will irreversibly remove file revisions or even file's complete history from perforce and will only work with administrator privileges. I don't know if obliterate is available through p4v, on the command line you would issue:
cd directory_of_accident
p4 obliterate accidentally_submitted_file
and if it looks like you and perforce agree on the file to forget
p4 obliterate -y accidentally_submitted_file
to seal the issue.
You can delete the items from the Perforce depot. Keep in mind Perforce will want to delete your local copy of that file so you should save it off in a different location, delete the file in Perforce and move the local version back.
Are you looking at your file structure through the Depot tab or the Workspace tab? It looks like it may be your Depot tab.
Try going to your Workspace tab then click on the Filter icon (looks more like a funnel) and ensure that "Show Files Not in Depot" is selected.
Hopefully looking through the Workspace tab, as opposed to Depot, will hide the deleted files, and selecting the appropriate filters will show your non-Perforce files.