On Perforce without checking out the files, i modified many files. But now i wanted to see list of all modified files.
I tried using p4 diff -f -sa, p4 changes -m 5 ./.. commands.
I am getting the below error:
Invalid user (P4USER) or client (P4CLIENT) name.
Purely numeric name not allowed - '123456'.
Please let me know how to resolve this error and find the list of modified/hijacked files.
Normally the command you'd want to use is "p4 status", but the error you're getting indicates that your P4USER and/or P4CLIENT is set incorrectly, and nothing's going to work until you fix that. (Your P4USER should be set to your Perforce user name, and your P4CLIENT to the name of the workspace that you synced these files to). You'll need to double check "p4 info" or "p4 set" and correct whichever it is that's not set correctly.
Just check out your entire branch (might take a few seconds) then revert unchanged files and what's left is all your modified files.
Related
I'm new to perforce and somehow I've gotten myself into a weird state.
I have two files that I modified and somehow added to a change list (not the default changelist). I want to revert the changes and delete the changelist but I can't figure it out.
I have tried doing this:
p4 change -d 75697
Change 75697 has 2 open file(s) associated with it and can't be deleted.
So I tried to revert the files in the change list:
p4 revert package.json
package.json - file(s) not opened on this client.
Okay, so I guess I need to open the file?
p4 edit package.json
//a/b/c/package.json - can't edit (already opened on this client)
So I can't revert the file until I open it but I can't open it because it's already open? What's the deal?
You could be getting that error because your local package.json doesn't map to the actual depot path that's open (due to something tricky you've done with your client view since opening the file). It's hard to say without seeing more command output, but try just:
p4 revert -c 75697 //...
to revert all files in that changelist regardless of their paths.
If that doesn't work, check with your Perforce admin; either they've put you into some really weird permissions bind (i.e. they've revoked the access level to the files that you need in order to revert them) that they should undo, or they'll need to do a bit of light db maintenance (p4d -xf 925) to fix an inconsistency.
I know that generally, when running p4 changes you need a clientspec specified, so that Perforce can limit the results properly.
Yet, in P4V, you are allowed to operate in a "no workspace selected" mode, and you can view changes, etc.
I want to do something similar from a script, but the only way I can think to accomplish this is to:
Create a temporary clientspec, with some general //depot/... mapping
Perform my operations (eg: p4 changes blabla)
Delete the temporary clientspec
But I don't want to have all these temporary clientspecs being created/destroyed all the time. P4V doesn't seem to be doing that in its "no workspace selected" mode.
Is there a way to acomplish the same, from the commandline?
Your client spec doesn't matter at all if you provide a depot path to the "p4 changes" command. Just run:
p4 changes //depot/...
or whatever command you were going to run with your temporary "//depot/..." mapped client spec.
Your client spec will ONLY come into play if you use an argument that is explicitly client-relative, such as a local file path, the #have revision specifier, et cetera. If you don't use a client-relative argument, it doesn't matter if your clientspec is undefined, if it maps only one file, or if it maps the whole world, you'll get the same results from "p4 changes" regardless.
I can't seem to figure out if there is a way to obliterate a changelist in perforce. The p4 obliterate is the key but it seem to require the file name. In my erroneous changelist there are lots of files so its not feasible to type them in. Can I obliterate by the changelist? I do see a similar question but they seem to do by file names + revision.
Note in my case I am obliterating the latest submission so I know there is nothing after it that's why its safe. I just need to grab it by changelist and not the 100+ files by name.
Try this:
p4 obliterate //...#=changelist
The //... lets it run over any file (incredibly dangerous!) but the #= revision specifier limits it to the specific files included in that changelist.
As a full answer, you will need to do this on command line, I don't see any way through UI.
To invoke command line go the perforce installation folder (usualy C:\Program Files\Perforce) and start windows command window here.
You will need to set the environment for command line so it works with your source database. I wish there was a way to start this from Perforce UI but I can't find it there. That way it would have probably set the environment variables already for you.
Run p4 Set command to see the environment variables and their current values (essentially perforce settings).
You will probably need to change p4port and p4passwd.
p4 set p4port=<your-src-server>:1666 // to configure server
Similarly change perforce password and username if needed. Now you should be able to connect to perforce server through command line.
Now you issue the obliterate command.
I'm trying to open an existing Perforce application. I made some local changes, like deleting files, which I want to undo (that is, I want my local copy to exactly match the repository once more -- delete added files, restore deleted files, and undo changes).
When I try to revert using the p4v gui client, I see this error:
file(s) not opened on this client
What am I doing wrong?
I did manage to revert all the changed files, but not the added/removed files.
Edit: I did the following:
Connect to a Perforce server using p4v
Map a directory to my local file system (lets say C:\Perforce)
Get the latest version of the repository
Go to C:\Perforce in Windows Explorer
Delete some files and folders
Add some files and folders
I would like to get back to the "pristine" state, the copy of exactly what's on the server when I got the latest version of the repository for the first time.
By the looks of the edited description you added and deleted files directly on the filesystem and not through perforce. Therefore Perforce doesn't know anything about those changes so there is nothing to revert. Typically when you want to add a file you use 'p4 add" (or the equivalent p4v operation), and when you delete, you should use 'p4 delete' (or again, the equivalent p4v operation).
Really, the best option to get back to a pristine state is to nuke the local copy of the code in c:\perforce (in windows explorer), go to p4v, right click the area you want to sync, and choose "Get Revision..." and in the subsequent dialog, make sure that the "force operation" checkbox is checked. This will tell Perforce that you want a new copy of everything regardless of whether you had it synced or not.
You can also run "reconcile offline work" in p4v. Right click the depot area and choose that option. It will scan through the local folder structure and give you a report of what files have been added that don't exist in perforce, what files were deleted, and what files were modified. From that dialog, you can right click on local files that don't exist in perforce and delete them, or you can 'p4 add' them. You can also sync deleted files.
HTH.
Just an extra not to point out another cause for this.
If the file name contains an unusual character that cannot be translated correctly the name on the client will never match that on the server.
The solution in this case is to spot that character in the file name (it will be a question mark emblem on Linux) and use a wildcard to help identify the file to the server so it can delete it etc (p4 deleting the file is a way to go).
This answer may not be your case. This happened to me when I edited the files on my local disk without logging into p4.
A quick fix at commandline is:
p4 login # make sure you've logged in
p4 edit <filename> # let p4 know you've edited the file
p4 revert <filename> # revert to "pristine" state
You can use p4 reconcile -w to restore your client to the state of the server. There is an alias called clean, which is also available in P4V on the right-click context menu as Clean....
There are several additional flags to control whether added and deleted files are deleted or restored, respectively.
The -w flag forces the workspace files to be updated to match the
depot rather than opening them so that the depot can be updated to
match the workspace. The -a, -d, and -e flags when used with -w
update workspace files as follows:
-a Files with no corresponding depot file are deleted.
-d Depot files not in the workspace are added.
-e Modified files are restored to the last version synced.
I am trying to remove a pending changelist in perforce. All the files (20 old) are new but have not be committed/submitted yet. So in p4Win, they show a RED + cross. I am failing to remove these files from the change list. How do I go about getting rid of these files?
Thanks for the answers to right-click and revert. I have tried that but it fails with the example error strings below.
Operation: user-revert
Librarian digest source/.../foo.c failed.
RCS checkout 1.715484 failed!
RCS no such revision 1.715484!
//source/.../foo.c#1 - was add, reverted
I've also tried the p4 revert command but it fails with same error(s).
Fixed with "revert -k" by perforce support group. They suspect it may be due to overlay values in the client workspace but have not been very specific.
How are you trying to remove the files?
It's been a while since I used Perforce in anger but I seem to remember that you just had to right click and revert the file.
I've just tried this and it worked OK for me (the programmer's lament!). It uses the following p4 command:
p4 revert //depot/test.txt
Where test.txt is the name of the test file.
Update
Does the new file still exist locally on your hard drive?
Does the path where the file would be in the depot still exist? ie. what's in the "..." of your path.
Revert files, right-click on file in change list and select revert, this will remove added files.
Maybe try Perforce support at this stage.
To remove all added files in current and sub directories:
p4 revert ...
In my case this happened because the RCS files (the actual files with ,v extension in the depot that contain all the revision information) were literally missing the information for the revision in question. I was able to restore the files from backup.
I had the same problem, I had added the .exe files but wanted to exclude them afterwards. The perforce documentation helped:
http://www.perforce.com/perforce/doc.current/manuals/p4eclipse/topics/adding.html
Excluding Files from Source Control
Important: you cannot exclude files after you have placed them under
Perforce control. If you have files opened in a changelist and you
want to exclude them from Perforce control, revert them from the
changelist before excluding them.
Worked like a charm.