I am creating a perforce client using
p4 client -o -t old_client new_client
I want to remove the Host variable from the perforce spec. I tried to override the Host value using
p4 -H '' client -o -t old_client new_client
but still the perforce client is getting created taking the Host info from p4 info command. Any idea how I can remove Host parameter. I am doing this programatically. So, opening the client file and removing Host wont work for me.
To remove the Host field from the workspace spec, do:
p4 client -o -t old_client new_client | grep -v Host: | p4 client -i
That is, simply grep out the Host field before submitting the client form back to the server.
Related
Trying to use perforce cli client (p4) to retrieve files from repository. I have a P4CONFIG=~/.p4config file configured with appropriate values.
When I try using the p4 command, I get the following error:
p4 login
Perforce client error:
Connect to server failed; check $P4PORT.
TCP connect to "ssl:fqdn.com:port" failed.
Servname not supported for ai_socktype
When I specify the p4 port (P4PORT), the command works:
p4 -p ${P4PORT} login
Note that perforce provides additional options that provide additional debug information:
p4 -p ${P4PORT} -vnet=5 -vrpc=5 login
Examine the values in your P4PORT environment variable.
echo ${P4PORT}
echo ${P4PORT} | od -c
grep P4PORT ~/.bashrc
Also examine the value perforce examines in your perforce config,
grep P4PORT ${P4CONFIG}
grep P4PORT ${P4CONFIG} | od -c
p4 set P4PORT
The problem was that the P4PORT value in the configuration file had quotes. The shell strips quotes, but (apparently) perforce does not strip quotes in the config file.
I have already created a perforce client with command:
p4 client -o -e <my_clientname>
and it gave a message created with the required user.
but while using this clientname for revert operation with command
p4 -c <my_clientname> revert <perforce_path...>
it gives me an error "Client <my_clientname> unknown - use 'client' command to create it."
Additional Info: I am working on a jenkins setup with Perforce plugin.
p4 client -o does not create your client; it simply prints out to stdout the form specification that you could have used to create your client.
To create your client, do:
`p4 client -o <my-client-name> | p4 client -i`
By the way, in your question, you wrote that you also passed the -e flag. I don't believe there is a -e flag to p4 client.
Note: I want to delete the changelist only not the client.
The answers in the following link doesn't work when the pending changelist is from an old workspace which is in an offline machine Perforce: How can I delete a changelist that p4v refuses to delete?
Tried the following command p4 -u <user> -c <client> -H <host> revert -k <file(s)>
But I'm not allowed to do as the workspace owner is different.
First get the USER and CLIENT:
p4 describe CHANGE
With a 2015.1+ server at this point you can just do:
p4 revert -c CHANGE -C CLIENT //...
p4 change -df CHANGE
With an older server it's a few more steps.
First get the HOST so you can bypass the hostname check:
p4 client -o CLIENT
Now login, revert the files, and delete the change:
p4 login USER
p4 -u USER -c CLIENT -H HOST revert -k -c CHANGE //...
p4 change -df CHANGE
Is there a way to update the name and views of an existing perforce client from command line instead of creating a new client(copying views from old client) and deleting old client ?
I know you can do this like
p4 client -t old_client new_client | p4 client -i
but that is copying views from old_client and creating new_client instead of updating old_client
I am trying to delete an old user from our perforce installation. A previous admin had deleted all their active workspaces / clients so we should be able to now delete the user, however when i run
p4 user -f -d auser
User auser has file(s) open on 1 client(s) and can't be deleted.
However auser no longer has any associated clients, and if I filter the pending changelist view in P4V it shows the user as having one file checked out in the default changelist but no client is specified. Even if I log in as the user I dont seem to be able to revert or do anything with the file. Any hints how I might solve this?
While both of these commands returned nothing:
$ p4 clients -u <USER>
$ p4 changes -s pending -u <USER>
This command showed me which file was open:
$ p4 opened -u <USER>
//depot/path/to/file#1 - edit default change (text) by <USER>#<CLIENT>
This command doesn't work:
$ p4 -u <USER> -H <CLIENT> revert -k //depot/path/to/file
//depot/path/to/file#1 - belongs to user <USER>, not reverted
Deleting the client does:
$ p4 client -o <CLIENT> > <CLIENT>.txt
$ p4 client -d -f <CLIENT>
$ p4 opened -u <USER>
File(s) not opened anywhere.
FTW! \o/
If you need to, you can then recreate the client with:
$ p4 client
Then read in the <CLIENT>.txt file you created with the output of p4 client -o <CLIENT> and save it.
More here:
http://answers.perforce.com/articles/KB_Article/Reverting-Another-User-s-Files
Solved.
A bit weird but this is what I did. I got the details of the default changelist that contained the file. It had the workspace name which was the name of a machine. I logged into the machine and then into perforce as the user. At this point I could see the pending changelist and revert the file. Now I can delete the user.
How did this happen?
I think what must of happened was a confusion of clients. A while back I changed the owner of quite a few clients on that machine (its the build server) and some of these clients must have had open files for the old user. This is the only explanation I can come up with.