我注意到在我的公司进行代码审查时,人们通常只提供他们的工作所在分支,而没有其他信息。因此,我猜想一定有一种简单的方法可以找到所有在给定分支中具有版本的文件,这相当于查找所有已更改的文件。
是的,我不知道在特定分支中查找文件的预期“简单方法”,所以需要您的帮助。提前感谢。
是的,我不知道在特定分支中查找文件的预期“简单方法”,所以需要您的帮助。提前感谢。
您可以快速列出特定分支的所有文件:
cleartool find . -type f -branch "brtype(abranch)" -print
我建议将此与以下内容结合使用:
-user
限制到特定用户,以防多个用户使用相同的分支。cleartool find . -type f -branch "brtype(abranch)" -user aloginname -print
-created_since
过滤器,查找自某个日期以来创建的所有元素,在同一分支上进行的任务具有增量审查的情况下非常有用。cleartool find . -type f -branch "brtype(abranch)" -element "{created_since(10-Jan)}" -user aloginname -print
import subprocess
import os
import sys
from optparse import OptionParser
def pipeCmd(Cmd):
pipe = subprocess.Popen(Cmd,
shell = True,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE )
(stdout_data,stderr_data) = pipe.communicate()
return (pipe,stdout_data,stderr_data)
def main(br_name):
cmd = "cleartool find -vis -avobs -element 'brtype(" + br_name + ")' -exec 'cleartool describe -short $CLEARCASE_PN'"
pipe,data,err = pipeCmd(cmd)
if 0 == pipe.returncode:
print data
else:
print err
# Process cmd arguments
if (1):
if (len(sys.argv) <= 1):
print "Finds all branches in your view."
print "\nExamples:\n"\
"allBranches.py -b $BRANCH_NAME \n"\
"allBranches.py --branch=$BRANCH_NAME\n"
parser = OptionParser()
branchName = "Example: 'rs__BRANCH_NAME_int'"
parser.add_option("-b", "--branch", dest="BRANCH_NAME", help=branchName, metavar="BRANCH_NAME")
(options, args) = parser.parse_args()
if (options.BRANCH_NAME):
print "\nFinding " + options.BRANCH_NAME + " elements...\n"
main(options.BRANCH_NAME)
sys.exit(0)