2009年12月16日 星期三

Linux Command - cvs tar/rtag/branch

// mark a new cvs tag "abc123"
# cvs tag abc123
T turn/lib/TurnClient.hxx ==> mark as "T" label
T turn/lib/TurnHmac.cxx
T turn/lib/TurnHmac.hxx
T turn/lib/TurnMsg.cxx
T turn/lib/TurnMsg.hxx
T turn/lib/log.cxx

// Mark a cvs tag "abc456" on a existing cvs branch
# cvs tag -r sipBranch abc456
# cvs st -v Makefile
userName@1.2.3.4's password:
===================================================================
File: Makefile Status: Up-to-date

Working revision: 1.38
Repository revision: 1.38 /home/cvs/XXX/Makefile,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)

Existing Tags:
abc456 (revision: 1.32) ==> This is produced by cvs tag
abc123 (revision: 1.38) ==> This is produced by cvs tag
sipBranch (branch: 1.32.2) ==> This is produced by cvs rtag -b
main (revision: 1.1.1.1) ==> This is produced by cvs import
vendor (branch: 1.1.1) ==> This is produced by cvs import


# cvs rtag -r branchABC -b branchABC_123 myProjectName
userName@1.2.3.4's password:
cvs rtag: warning: cannot open /home/cvs/CVSROOT/val-tags read/write: Permission denied
cvs rtag: Tagging myProjectName
cvs rtag: Tagging myProjectName/AutoTestAgent
cvs rtag: Tagging myProjectName/AutoTestAgent/AutoTestAgent


// cvs revision/branch 版號的制定邏輯請見下面分析
// 查看目前local 端skype 檔案的目前狀態,目前client 端工作版本為1.3.2.1.2.1, CVS Server 端的版本為1.3.2.1.2.1 (一樣),
目前client 端的檔案是隸屬於ID_1_6 這個branch的分支

// 另外在下面有列出目前隸屬於skype 這個檔案所有的tag name, branch name, 由這邊可知,
目前共存在有3個branch

[root@nestlin-7 l7fw]# cvs st -v ./skype
userName@1.2.3.4's password:
===================================================================
File: skype Status: Up-to-date ==> client 與server 的檔案一致

Working revision: 1.3.2.1.2.1 ==> Client 端, Working Directory revision
Repository revision: 1.3.2.1.2.1 ==> Server 端, Repository Directory revision
Sticky Tag: ABC_123 (branch: 1.3.2.1.2) ==> 目前Working Directory 的branch/revision
Sticky Date: (none)
Sticky Options: (none)

Existing Tags:
PPP_1_6 (branch: 1.5.2)
ABC_123 (branch: 1.3.2.1.2)
III_123 (branch: 1.3.2)

# cvs log ./skype
userName@1.2.3.4's password:

RCS file: /home/cvsroot/X/Y/Z/skype,v
Working file: skype
head: 1.6
branch:
locks: strict
access list:
symbolic names:
PPP_1_6: 1.5.0.2
ABC_123: 1.3.2.1.0.2
III_123: 1.3.0.2

keyword substitution: kv
total revisions: 13; selected revisions: 13
[omit]
----------------------------
revision 1.3
date: 2005/03/04 09:59:51; author: userName; state: Exp; lines: +3 -3
branches: 1.3.2; ==> 從這邊可以知道有切一個branch 1.3.2, 參考上面cvs st -v 的指令可知道,其branch name 為III_123
User Commit Descriptions
----------------------------
[omit]
revision 1.3.2.1
date: 2005/03/09 09:06:03; author: userName; state: Exp; lines: +1 -0
branches: 1.3.2.1.2; ==> 從這邊可以知道有切一個branch 1.3.2.1.2, 參考上面cvs st -v 的指令可知道,其branch name 為ABC_123
User Commit Descriptions
----------------------------
[omit]

# cvs st -v Makefile
userName@1.2.3.4's password:
===================================================================
File: Makefile Status: Up-to-date

Working revision: 1.38
Repository revision: 1.38 /home/cvs/XXXXX/Makefile,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)

Existing Tags:
branch_1_32_branch_20091216 (revision: 1.32)
tag456 (revision: 1.38)
branch_1_32 (branch: 1.32.2)
main (revision: 1.1.1.1)
vendor (branch: 1.1.1)

# cvs log Makefile | more
userName@1.2.3.4's password:

RCS file: /home/cvs/XXXXX/Makefile,v
Working file: Makefile
head: 1.38
branch:
locks: strict
access list:
symbolic names:
branch_1_32_branch_20091216: 1.32
tag456: 1.38
branch_1_32: 1.32.0.2
main: 1.1.1.1
vendor: 1.1.1
keyword substitution: kv


從上面的情況可知
原先在main trunk上面有切了一個branch III_123 (branch 1.3.2), 後來又在該branch (1.3.2) 上面又切了一個branch ABC_123(1.3.2.1.2), 這裡可以做出下面的結論
1. main trunk 的revision 是從1.1, 1.2, 1.3開始的
2. 如果從main trunk 切branch, 則branch 會變成1.X.Y (e.g. 如果從1.3切branch, 則新版號為1.3.2), 如果是從第一層branch 要切第二層branch, 則版號會是1.3.2.M.N (e.g. 譬如上面從III_123 branch 1.3.2 的子版本1.3.2.1 切出來, 版號會變成1.3.2.1.2
所以
main trunck 的revision main number 為1(1碼), main+sub revision number為1.M(2碼, 從1.1開始)
第一層branch 的revision main number 為1.M.2(3碼), main+sub revision number為1.M.2.N(4碼, 從1.M.2.1開始)
第二層branch 的revision main number 為1.M.2.N.2(5碼), main+sub revision number為1.M.2.N.2.O(6碼, 從1.M.2.N.2.1開始)
==> 結論cvs revision 奇數碼數為branch (如1.3.2), 偶數碼數為tag (如1.32), 只有偶數碼才是真正的revision number, 奇數碼只是main trunk/branch 的base而已
3. symbolic names 和 Existing Tags的關係如下
Existing Tags 表示該branch/tag是從哪一個原先的版號切出來的
Symbolic names 則是一個CVS 內部版號link mark(不確定是否正確), 碼數固定為偶數碼, 其規則如下
a. branch 將原先的Existing Tag 尾碼 .2 改成 .0.2, 例如上面branch branch_1_32 1.32.2, 其Symbolic name為1.32.0.2
b. revision 的Existing Tag 和 Symbolic 的revision完全相同
c. 上面a點所描述的情形中, 唯一會有例外的是vendor branch, 這是利用cvs import 所產生的imitial project(將既存的project import到cvs repository當中), 如下所示
cvs import -m "initial" project-name vendor main

會發現vendor 這個branch在 Existing TAG 和 Symbolic Name 上面的revision 完全相同, 而且這是一個branch, 可能這個vendor branch 對cvs而言有特別的意義?

沒有留言: