Changing workspace clobber option directly from Perforce command line

五迷三道 提交于 2019-12-30 09:38:12

问题


How to change perforce specs from command line? What I want to do is, i have a workspace whose clobber option is set to noclobber(default value). Now i want to change it to clobber.

I know we can do it directly from p4v, but i dont want that. I also know that if we run 'p4 client' command in cmd, it will open P4CONFIG file in text editor, where we can change noclobber to clobber and save the file and its done, but i also dont want that too.

Please tell me the specific command which directly changes the noclobber to clobber without using p4v or without editing P4CONFIG.txt.

Thanks and Regards, Noob perforce admin


回答1:


It's pretty easy to script this with Perl, Python, Ruby, or even Powershell. Here's a one-liner in Powershell:

p4 client -o | %{$_ -replace "noclobber", "clobber"} | p4 client -i




回答2:


If you're trying to avoid repeatedly opening a text editor, you can accomplish your goal with a little bit of sed, like this:

p4 client -o | \
sed 's/ noclobber/ clobber/' | \
p4 client -i



回答3:


Simplest solution:

P4EDITOR='sed -i s/noclobber/clobber/' p4 client


来源:https://stackoverflow.com/questions/16277331/changing-workspace-clobber-option-directly-from-perforce-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!