2011-12-27 52 views
0

我試圖使用NetBeans Java CVS客戶端訪問CVS。如何使用NetBeans Java CVS客戶端?

我可以簽出項目,但我的要求是獲得文件頭部的CVS.ex標籤中的文件名稱TAG

我已經廣泛搜索,發現TAGCOMMAND類,但不知道如何使用它與 Client.excecuteCommand(command)方法。

任何人都可以建議或顯示一些示例代碼,瞭解如何使用NetBeans Java CVS客戶端獲取CVS標籤的文件?

+0

任何人都可以看看這個。 – David 2011-12-28 10:25:08

回答

4

答案可能有點晚,但這裏有一些使用標記命令的示例代碼。 這個用法很簡單。

1)創建客戶端。

PServerConnection con = new PServerConnection(getCVSRoot()); 
con.setEncodedPassword(StandardScrambler.getInstance().scramble(password)); 

GlobalOptions globalOptions = new GlobalOptions(); 
globalOptions.setCVSRoot(getCVSRoot().toString()); 

client = new Client(connection, new StandardAdminHandler()); 

// this line is important, because otherwise you'll get a 
// NullpointerException! 
client.setLocalPath(localPath); 

2)創建標籤命令

TagCommand tagCmd = new TagCommand(); 
tagCmd.setTag(tag); 
tagCmd.setOverrideExistingTag(true); 

3)執行

client.getConnection().open(); 
boolean success = client.executeCommand(cmd, globalOptions); 
client.getConnection().close(); 

我使用的最新版本從[1]。

問候裏奇

[1] http://netbeans.org/projects/versioncontrol/downloads/