开发者

Is it possible to use global options in P4.NET?

I am using P4.NET to control perforce programmatically but there doesn't seem to be a way to specify global options like 开发者_StackOverflow社区this:

http://www.perforce.com/perforce/doc.current/manuals/cmdref/o.gopts.html

Maybe someone else has an experience on how to do this?


You can set the global environment values using the P4Connection class like so

P4Connection p4 = new P4Connection();   
p4.Host = "127.0.0.1";    
p4.Port = 1666;   
p4.User = "joan.verge";   
p4.Client = "joanverge_main";   

If these values are not set, it will use the environment settings set in your client configuration file or windows registry (for Linux and OSX there is a configuration file in the ~.p4 directory).

If you use Perforce via the command line I would highly recommend you set up a client configurations (Note: I only know how to do this on Windows, refer to P4 KB for other platforms).

First set your global environment settings using the command line.

p4 set P4USER=joan.verge
p4 set P4PORT=127.0.0.1:1666

To test the above have been set correctly, use p4 info.

Next, put the workspace/client specific settings into a text file named p4config (no extension) and place it in the root of your workspace/client.

P4CLIENT=joanverge_main

Set one more environment variable,

p4 set P4CONFIG=p4config

Copy the p4config file to another workspace/client, edit the P4CLIENT variable to match.

Now on the command line, navigate to both directories and compare the p4 info command.

Also, setting this up allows you to use the P4 windows explorer navigation across multiple workspaces.

Edit: you might find this StackOverflow question useful that was answered by Mike a few months ago with setting the Charset property: P4.Net and P4CHARSET.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜