2008-11-19 60 views
9

我想知道如何將Perforce倉庫位置轉換爲客戶端視圖位置以用於腳本編寫。如何將Perforce倉庫位置轉換爲客戶端視圖位置

我有一個腳本,首先簽出一個文件在perforce編輯,然後與文件進行交互。我需要將軟件倉庫位置(即\ Projects \ Project6)轉換爲客戶機視圖位置。 (即d:\ Projects \ Project6)。

這可能嗎?

+1

Perforce公司是最差的。 – bharal 2013-07-22 15:28:53

回答

2

檢出p4 have命令。你給它要麼一個倉庫位置一個客戶端文件名,它給你的倉庫位置,客戶端文件名,你的文件的版本。

3

我會使用p4 fstat命令。我發現它的格式比p4有稍微容易解析。此外,如果您正在使用python編寫腳本,則可以使用-G option將返回值編組爲python字典。

注意到您也可以輸入p4幫助命令來查看命令列表和他們所做的簡短描述。

11

我一直使用p4,其中命令爲此。下面是從內置幫助其描述:

where -- Show how file names map through the client view 

p4 where [ file ... ] 

    Where shows how the named files map through the client view. 
    For each argument, three names are produced: the name in the 
    depot, the name on the client in Perforce syntax, and the name 
    on the client in local syntax. 

    If no file is given, the mapping for '...' (all files in the 
    current directory and below) is shown. 

    Note that 'p4 where' does not determine where any real files are. 
    It only computes where they should be according to the client view. 
+0

如果你想解析`p4 where'的輸出並且你的文件名中有空格,請參閱http://maillist.perforce.com/pipermail/perforce-user/2007-February/020820.html - 我發現了類似`p4其中-T quack // blah/somefile.txt`運行良好。 `quack`部分只是在輸出中引用,但你必須在那裏放置一些東西。此外,由於`p4 where`可以爲複雜的工作空間輸出多個結果(請參閱http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_where.html中的使用說明),請確保您僅採用最後一條有趣的線(我認爲這是安全的)。 – entheh 2014-08-05 12:11:38