I mentioned this before :
(Currently that's not a great option for me because I talk to both my home P4 server and my work P4 server, and P4 stupidly does not have a way
to set the server by local directory. That is, if I'm working on stuff in c:\home I want to use one env spec and if I'm in c:\work, use another
env spec. This fucks up things like NiftyPerforce and p4.exe because they just use a global environment setting for server, so if I have
some work code and some home code open at the same time they shit their pants.
I think that I'll make my own replacement p4.exe that does this the right way at some point; I guess the right way is probably to do something
like CVS/SVN does and have a config file in dirs, and walk up the dir tree and take the first config you find).
But I'm having second thoughts, because putting little config shitlets in my source dirs is one of the things I hate about CVS. Granted it would be much better in this case - I would only need a handful of them in my top level dirs, but another disadvantage is my p4bydir app would need to scan up the dir tree all the time to find config files.
And there's a better way. The thing is, the P4 Client specs already have the information of what dirs on my local machine go with what depot mappings. The problem is the client spec is not actually associated with a server. What you need is a "port client user" setting. These are stored as favorites in P4Win, but there is no authoritative list of the valid/good "port client user" setups on a machine.
So, my new idea is that I store my own config file somewhere that lists the valid "port client user" sets that I want to consider in p4bydir. I load that and then grab all the client specs. I use the client specs to identify what dirs to map to where, and the "port client user" settings to tell what p4 environment to set for that dir.
I then replace the global p4.exe with my own p4bydir so that all apps (like NiftyPerforce) will automatically talk to the right connection whenever they do a p4 on a file.
perforce supports this just fine afaik via the P4CONFIG perforce environment variable.
ReplyDeletedo "p4 set P4CONFIG=p4.cfg".
Then, in the root of each of your trees, make a text file called p4.cfg, containing your config.
in your case, you'd have "P4PORT=ipaddress:port" be different for each, and also P4CLIENT.
Ha! Outrageous!
ReplyDeleteThanks.
I can't believe I've been annoyed by not having that feature for the last N years.