Where is the default .p4config file located? - perforce

I changed the P4PORT variable with the following command:
p4 configure set P4PORT=<local IPv4>:80
But now I am unable to connect to, or even start the perforce server. I was hoping that maybe someone would know where the default location for the .p4config file (I don't even think I know its proper name...) is so I can manually change the P4PORT value back to something that works.

p4 configure (server configurables persisted in the server db) is completely separate from P4CONFIG (client configurables persisted in a client-side text file).
If you've set P4PORT to an invalid value via p4 configure, you'll want to:
Check the log file (look for a file with log in its name in the P4ROOT directory) to confirm the error. I'm guessing you'll see an error about being unable to listen on that port.
Fix P4PORT via p4d -cset. (You don't want to mess around with db.config manually.)
Try again to restart the server, and start from step 1 if needed.
See p4d -h:
Configuration options:
-cshow
'-cset [server#]variable=value'
'-cunset [server#]variable'
This syntax provides a limited subset of the functionality of the
'p4 configure' command, and is useful for accessing the configuration
when the server is down. The '-cshow' flag displays the contents of
the db.config table, similar to 'p4 configure show allservers'.
The '-cset' and '-cunset' flags set or unset a configurable. When
using set or unset, enclose the entire expression in quotation marks,
and on Windows, use double quotation marks, not single ones.

Related

Open file in a running nvim-qt instance

I want to open new files from the command line on Windows in a single nvim-qt instance that is already open.
I know the existence of the --server option, but how do I know the IP or the socket name or path of the running instance?
As el_technic0 said, the neovim-remote utility is the easiest way to get remote file opening to work. I even added an alias to it in my .bashrc file (alongside the listen address definition) for easier invocation:
export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
alias vim='nvr --remote'
This way the first call will start a new neovim instance, and subsequent calls will be forwarded to that instance.
You may also want to add the set hidden option to your init.vim configuration file, otherwise subsequent calls may fail if the current buffer contains unsaved changes.

Can't change Perforce host

Some time ago I seemed to have locked in my P4 host and can't change it.
I've tried
set p4host=my_host
but it doesn't seem to clear it out or change it. Command line p4 info returns the old host name. I'm unsure how I got it this way -- possibly by setting it system wide, but now I'm unsure how to revert it. I'm in a directory that does not have a p4config.txt file and is empty.
I'm using Windows 10 Pro.
Run:
p4 set P4HOST
to see where your P4HOST value is coming from. Different ways of setting it (P4CONFIG, system environment, registry, P4ENV) have different levels of precedence.
Unfortunately I don't know what platform you're on so I can't give any hints about likely places to look, but hopefully whatever p4 set tells you will put you on the right track.
Recently I was unable to switch or access my workspace as hostname was changed. I just followed the following steps:
Right-click 'Edit workspace'.
Go to the 'Advanced' tab.
Change the hostname and hit Ok.
Done!
use export P4HOST=""

have to set port every time in command line when trying to trigger any Perforce command

I'm new to Perforce, need to work in command line, i'm so confused why all the commands on the tutorial websites all write like $p4 command, but I have to add the port every time when try to trigger that command, for an example, for $p4 sync, i have to type $p4 -p myhost:myport sync every time even after I logged in, if i missed the host and port, like if i just typing $p4 sync, the program will just hang in there... anyone can provide some suggestions?
There are a couple ways to make myhost:1666 the default. These are, in the order of decreasing precedence:
command-line options (like -p myhost:1666)
the P4CONFIG file
environment variables (%P4PORT%)
on Windows, the registry (use p4 set P4PORT=myhost:1666 to set it)
See the docs here.
In your case, I guess the registry (if on Windows) or the env. var. (if on Linux) is the best option.
Type:
p4 set P4PORT=myhost:myport
From that point on, "myhost:myport" will be used as the P4PORT when you run commands.
If you use multiple workspaces/servers, P4CONFIG files make it easy to have different sets of settings (based on your working directory), but for a single value, "p4 set" is a nice persistent one-shot method.

Perforce - Find modified/Hijacked Files

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.

GVim taking forever to load when connected to office network

When I load GVim from the Cygwin command line or when I'm not connected to the office network (mapped to U:/) it loads instantaneously. It takes a good minute or so to open when I'm on the network. What is going on here?
You probably need to set your $HOME directory to something other than U:/. Create a $HOME environment variable for Windows that points to My Documents or whatever and it won't try and use U:/. You may need to log-off/log-in to pick up the changes.
You should check what your $HOME directory is mapped to in each case. I bet that it is different depending on if you are connected to the network or not.
Do you have any custom .vimrc or other config files read at startup? If nothing else, vim will query your $HOME directory to look for such files. If your network is slow, it could cause your problem.
See ":help startup" inside vim for more details on the startup process.
It might also be a good idea to set the directory and backupdir options so they prefer a local directory. Something along the lines of
set backupdir^=C:/Temp
set directory^=C:/Temp//
The ^= syntax puts the directory at the start of the list of directories for each option. The trailing // for directory tells Vim to encode the full path to the file being edited in the swapfile's name. This allows for swapfiles to be created in one directory when editing multiple files with the same name, but different paths.

Resources