Python和ClearCase setview [英] Python and ClearCase setview
问题描述
我想从python脚本设置为一个clearcase视图,然后在该视图中执行命令。我尝试使用此处概述的各种方法:
I would like to set to a clearcase view from a python script, and then execute commands within that view. I have tried using various methods outlined here:
但是我没有任何成功。有人知道如何做到这一点吗?
but I have not had any success. Does anyone know how to accomplish this?
推荐答案
我不建议设置视图,因为 setview
本身产生了一个新的过程。
我真的更喜欢使用 / view / viewTag / aVob /。 。
在启动视图( cleartool startview viewTag
)
I wouldn't recommend setting a view, because setview
itself spawn a new process.
I really prefer working with /view/viewTag/aVob/...
after starting the view (cleartool startview viewTag
)
生成过程指的是生成过程。在我看来,这个问题使一切变得太复杂了,并解释了为什么会有类似以下的技术说明:
The "spawn process" issue makes the all thing too complex in my opinion, and explains why you have technotes like:
- "Setting into a view from a shell script does not process the remaining commands in the script".
执行
cleartool setview cmview
后出现的任何命令因为用exec()
产生了一个外壳,它用一个新程序替换了当前程序。
Any commands that appear after the execution of
cleartool setview cmview
are not processed because a shell is spawned off withexec()
, which replaces the current program with a new program.
这意味着当前进程的文本和代码段(在本例中为包含所有命令的脚本)被正在执行的程序替换,该程序是通过运行 cleartool setview cmview
调用的外壳程序。 br />
因此,在 setview
的调用点之外,不会处理任何命令。
This means current process's text and code segments, which in this case is the script that contains all the commands, is replaced by the program getting executed, which is the shell invoked by running cleartool setview cmview
.
Hence, none of the commands are processed beyond the point of invocation of the setview
.
- 通过发出setview -exe或-login如何处理生成的外壳,并影响子外壳进程
- "How spawned shell is handled by issuing setview -exe or -login and affect on subshell process"
- 有一个调用
setview
- 但
setview
调用将使用-exec
参数是另一个python脚本(当/ vobs
配置了上述set视图的内容时,您想做的事情。 - have a python script calling
setview
- but that
setview
call would be with an-exec
parameter being another python script (doing what you want to do when that/vobs
is configured with the content of said set view.
-exec
变量将启动子shell进程并在指定的动态视图中调用指定的命令。命令完成后,控件将返回到父外壳。
-exec
不会在父外壳中设置视图进程。
生成的-exec
子Shell将继承父Shell进程的Environment变量。但是,在子外壳中创建的环境变量不会传递回父外壳。
The
-exec
variable will start a subshell process and invoke the specified command in the dynamic view specified. Control is then returned to the parent shell once the command has finished.
The-exec
will not set the view in the parent shell process.
The-exec
spawned subshell will inherit the Environment variables of the parent shell process; however, the Environment variables created in the child shell will not pass back into the parent shell.
因此,如果您真的想要要使用 setview
,您可以(不能直接对自己进行测试):
So if you really want to use setview
, you could (not tested directly myself):
这篇关于Python和ClearCase setview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!