顯示具有 開發:SubVersion 標籤的文章。 顯示所有文章
顯示具有 開發:SubVersion 標籤的文章。 顯示所有文章

2007年6月1日 星期五

svn:externals

svn:externals屬性保存了指導Subversion從一個或多個取出的工作拷貝移出目錄的指示。

外部定義

有時候創建一個由多個不同檢出得到的工作拷貝是非常有用的,舉個例子,你或許希望不同的子目錄來自不同的版本庫位置,或者是不同的版本庫。你可以手工設置這樣一個工作拷貝—使用svn checkout來創建這種你需要的嵌套的工作拷貝結構。但是如果這個結構對所有的用戶是很重要的,每個用戶需要執行同樣的檢出操作。

很幸運,Subversion提供了外部定義的支援,一個外部定義是一個本地路經到URL的影射—也有可能一個特定的修訂版本—一些版本化的資源。在Subversion你可以使用svn:externals屬性來定義外部定義,你可以用svn propsetsvn propedit(見“爲什麽需要屬性?”一節)創建和修改這個屬性。它可以設置到任何版本化的路經,它的值是一個多行的子目錄和完全有效的Subversion版本庫URL的列表(相對於設置屬性的版本化目錄)。

$ svn propget svn:externals calc

third-party/sounds http://sounds.red-bean.com/repos

third-party/skins http://skins.red-bean.com/repositories/skinproj

third-party/skins/toolkit -r21 http://svn.red-bean.com/repos/skin-maker

svn:externals的方便之處是這個屬性設置到版本化的路徑後,任何人可以從那個目錄取出一個工作拷貝,同樣得到外部定義的好處。換句話說,一旦一個人努力來定義這些嵌套的工作拷貝檢出,其他任何人不需要再麻煩了—Subversion會在原先的工作拷貝檢出之後,也會檢出外部工作拷貝。

注意前一個外部定義實例,當有人取出了一個calc目錄的工作拷貝,Subversion會繼續來取出外部定義的專案。

$ svn checkout http://svn.example.com/repos/calc

A calc

A calc/Makefile

A calc/integer.c

A calc/button.c

Checked out revision 148.

Fetching external item into calc/third-party/sounds

A calc/third-party/sounds/ding.ogg

A calc/third-party/sounds/dong.ogg

A calc/third-party/sounds/clang.ogg

A calc/third-party/sounds/bang.ogg

A calc/third-party/sounds/twang.ogg

Checked out revision 14.

Fetching external item into calc/third-party/skins

如果你希望修改外部定義,你可以使用普通的屬性修改子命令,當你提交一個svn:externals屬性修改後,當你運行svn update時,Subversion會根據修改的外部定義同步檢出的專案,同樣的事情也會發生在別人更新他們的工作拷貝接受你的外部定義修改時。

svn status命令也認識外部定義,會爲外部定義的子目錄顯示X狀態碼,然後叠代這些子目錄來顯示外部專案的子目錄狀態資訊。

提示

你一定要要考慮在所有的外部定義中使用明確的修訂版本,這樣做意味著你已經決定了何時拖出外部資訊不同的快照,和精確的拖出哪個快照。除了不會受到第三方版本庫的意外修改的影響以外,當你的工作拷貝回溯到以前的版本庫時,使用明確的修訂版本號會讓外部定義回到以前的那個修訂版本,也意味著外部定義的工作拷貝更新會匹配以前修訂版本的樣子。對於軟體專案,這可能是編譯複雜代碼基的老快照成功和失敗的區別。

Subversion目前對外部定義的支援可能會引起誤導,首先,一個外部定義只可以指向目錄,而不是文件。第二,外部定義不可以指向相對路徑(如../../skins/myskin)。第三,通過外部定義創建的工作拷貝與主工作拷貝沒有連接,所以舉個例子,如果你希望提交一個或多個外部定義的拷貝,你必須在這些工作拷貝顯示的運行svn commit—對主工作拷貝的提交不會叠代到外部定義的部分。

另外,因爲定義本身使用絕對路徑,移動和拷貝路徑他們附著的路徑不會影響他們作爲外部的檢出(儘管相對的本地目標子目錄會這樣,當然,根據重命名的目錄)。這看起來有些迷惑—甚至讓人沮喪—在特定情形。舉個例子,如果你在/trunk開發線對一個目錄使用外部定義,指向同一條線上的其他區域,然後使用svn copy把分支開發線拷貝到/branches/my-branch這個新位置,這個專案新分支的外部定義仍然指向/trunk版本化資源。另外,需要意識到如果你需要一個重新規劃你的工作拷貝的父目錄(使用svn switch --relocate),外部定義不會重新選擇父目錄。

最後,你或許經常希望svn子命令不會識別或其他作爲外部定義處理的結果的外部工作拷貝上的操作,在這種情況下,你可以對子命令使用--ignore-externals選項。

Read More......

2007年5月24日 星期四

使用svn://協定進行版本權限控管

在預設svnserve的模式中不進行權限控管,因此無論進行任何動作皆無限制,並且不會記錄開發人員名稱,若日後發生問題將無從查起。

因此我們必須加入權限控管的設定。

開啟D:\SVN_Repository\repository\conf下的二個檔案。

svnserve.conf

### This file controls the configuration of the svnserve daemon, if you

### use it to allow access to this repository. (If you only allow

### access through http: and/or file: URLs, then this file is

### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

# [general]

### These options control access to the repository for unauthenticated

### and authenticated users. Valid values are "write", "read",

### and "none". The sample settings below are the defaults.

# anon-access = read

# auth-access = write

### The password-db option controls the location of the password

### database file. Unless you specify a path starting with a /,

### the file's location is relative to the conf directory.

### Uncomment the line below to use the default password file.

# password-db = passwd

### This option specifies the authentication realm of the repository.

### If two repositories have the same authentication realm, they should

### have the same password database, and vice versa. The default realm

### is repository's uuid.

# realm = My First Repository

[general]

anon-access = read

auth-access = write

password-db = passwd

註解移除

passwd

### This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

# [users]

# harry = harryssecret

# sally = sallyssecret

修改為

[users]

帳號 = 密碼

即可

Read More......

在Windows系統中安裝SVN Service

文章來源:http://www.subversion.org.cn/index.php?option=com_content&task=view&id=83&Itemid=9
作者: rocksun 2006-10-26 作者:Rock Sun, Subversion中文站。

以前的svnserve要想成爲windows服務,必須依賴於svnservice或其他工具。從Subversion1.4開始,Subversion本身就集成Windows服務的工具。

1,安裝svnservice

Windows NT中(包括Windows XP, Windows 2000, Windows 2003 Server)本身包含了一個安裝服務的工具,叫做"Service Control",也就是sc.exe

例如我的Subversion安裝在"D:\Subversion",版本庫在"D:\svnroot",而我希望對應的Subversion服務名爲svnservice,安裝這個svn服務的命令就可以這樣寫:

sc create svnservice

binpath= "D:\Subversion\bin\svnserve.exe --service -r D:\svnroot"

displayname= "SVNService"

depend= Tcpip


請注意,因爲便於察看,上面的命令分爲多行,但在實際執行時應該在一行裏。另外,在以前啓動svnserve時會使用"-d"選項,也就是守護進程模式,在這裏不能使用,會導致服務無法啓動。同樣,"-i""-t"選項也不能使用。

在命令行窗口執行完這個命令之後,服務還沒有啓動,你可以繼續運行"net start svnservice"啓動這個服務,然後使用"net stop svnservice"停止服務。

另外還有兩點需要小心處理。首先,如果路徑中包括空格,一定要用“\”處理“"”號,例如上面的例子中如果svnserve.exe在“c:\ program files\subversion\”中,則命令應該寫爲“binpath= "\"c:\program files\subversion\bin\svnserve.exe\"”(“”中的內容),整個命令如下,紅色部分是改變部分:

sc create svnservice

binpath= "\"D:\program files\Subversion\bin\svnserve.exe\" --service -r D:\svnroot"

displayname= "SVNService"

depend= Tcpip

其次,sc對選項的格式還有要求,例如“depend= Tcpip”不能寫爲“depend = Tcpip”或“depend=Tcpip”,也就是“=”前不能有空各,而後面必須有空格。


2,刪除服務

如果服務安裝的有問題,你可能需要刪除服務。要刪除前面添加的服務,只需要運行"sc delete svnservice""svnservice"就是我們創建服務時使用的名字。


3,配置服務是自動啓動

默認情況下安裝的服務不會隨Windows的啓動而啓動,爲了使svn服務能夠隨Windows啓動而啓動,需要修改一下"sc create"命令(首先要刪除),增加"start= auto"選項:

sc create svnservice

binpath= "D:\Subversion\bin\svnserve.exe --service -r D:\svnroot"

displayname= "SVNService"

depend= Tcpip

start= auto

當然你也可以使用圖形化的工具修改服務的屬性,你可以在“開始->運行...”中執行"services.msc",然後在介面中修改。


Read More......