2010-05-07 23 views
10

我注意到,在執行代碼視圖時,我公司的人員通常只給他的工作完成的分支,而沒有別的。所以我想必須有一個簡單的方法來找出在給定的分支中有一個版本的所有文件,這是找到所有文件已被更改的所有文件 。如何在給定的分支中查找文件

是的,我不知道在某些分支中查找文件的「簡單方法」,因此需要您的幫助,並提前致謝。

+0

更多信息也在這裏http://stackoverflow.com/questions/5800926/how-to-find-the-files-modified-under-a-clearcase-branch – x29a 2014-03-03 15:03:31

回答

21

您可以快速列出從一個特定分支的所有文件:

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 
+0

是什麼created_since過濾器之間的差異in -version(如http://stackoverflow.com/questions/22300632/cleartool-finding-changes-from-specific-date中所述)以及這裏使用的-element?結果肯定不同。 – x29a 2015-01-15 09:02:16

+0

@ x29a它只是在什麼項目created_since apply:元素(意思是當一個文件已被「添加到源代碼管理」或該元素的版本(意思是所有的版本檢查自某日期後) – VonC 2015-01-15 09:08:59

+0

我創建了一個這個問題的新問題:http://stackoverflow.com/questions/27959952/cleartool-difference-between-element-andversion - 抱歉的混亂。編輯限制5分鐘讓我;/ – x29a 2015-01-15 09:09:30

1

這裏是一個Python腳本,做的伎倆。它可能看起來更復雜,但它是複製粘貼並去。隨意用VonC's換出cmd。

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) 
+0

如果您使用Windows ClearCase的報告Builder'可用於查找具有給定分支名稱的所有元素,以及用於查找最新版本號(顯式元素)的選項。 – 2016-02-23 22:29:08

相關問題