6.1. CVS 中的文件和目录的共享

客户端通过本地配置文件(CVS目录中的文件),来记录存储信息,因此可以在客户端 的一个目录树下,维护多个工程、不同分支代码,甚至是不同CVS服务器的代码。

还可以通过服务器端配置文件:CVSROOT/modules,来将不同目录、文件组合 成单独的模块,免除了客户端在一个目录树下多次 Check 不同目录的繁琐。

如下两个方式Check代码等同,但显然第一种方式好。

方式一: 通过服务器端的 modules 配置文件控制

# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co CVSROOT
# cd CVSROOT
# vi modules
######## modify modules file as the follows:
johnson_homepage jiangxin/web &docbook/project &docbook/nightlybuild \
             &docbook/pm_fw_plan_2_4 &docbook/steam_trans \
             &docbook/docbook_howto &docbook/pgp &docbook/program_rules \
             &docbook/tip_sysconfig &docbook/images &docbook/pm_fw_diary_2_4 \
             &docbook/rd_hwenv &docbook/steam_admin &docbook/tip_sysinstall \
             &docbook/lession_scm &docbook/pm_fw_module_debug \
             &docbook/steam_howto

# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -c
# 显示服务器端配置文件 modules 的内容
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d web johnson_homepage
# Checkout 代码

方式二: 通过在客户端,在目录树下不同的目录执行不同的 Checkout 动作实现。

# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d web jiangxin/web
# cd web
# ls
# mkdir docbook
# cd docbook
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d project           docbook/project
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d nightlybuild        docbook/nightlybuild
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d pm_fw_plan_2_4      docbook/pm_fw_plan_2_4
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d steam_trans         docbook/steam_trans
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d docbook_howto       docbook/docbook_howto
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d pgp                 docbook/pgp
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d program_rules       docbook/program_rules
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d tip_sysconfig       docbook/tip_sysconfig
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d images              docbook/images
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d pm_fw_diary_2_4     docbook/pm_fw_diary_2_4
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d rd_hwenv            docbook/rd_hwenv
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d steam_admin         docbook/steam_admin
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d tip_sysinstall      docbook/tip_sysinstall
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d lession_scm         docbook/lession_scm
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d pm_fw_module_debug  docbook/pm_fw_module_debug
# cvs -d :pserver:jiangxin@10.0.0.152:/home/repos-user co -d steam_howto         docbook/steam_howto

服务器端目录结构

# pwd
/home/repos-user

# mtree -cdin  -k type   

#          user: jiangxin
#       machine: openbsd
#          tree: /usr/home/repos-user
#          date: Tue Sep 10 21:34:26 2002
/set type=dir
.              
    CVSROOT        
        Emptydir       
        ..
    ..
    docbook        
        project      
        ..
        docbook_howto  
        ..
        images         
            callouts       
            ..
        ..
        lession_scm    
        ..
        nightlybuild   
        ..
        pgp            
            images         
            ..
        ..
        pm_fw_diary_2_4
        ..
        pm_fw_module_debug
        ..
        pm_fw_plan_2_4 
            Attic          
            ..
        ..
        program_rules  
        ..
        rd_hwenv       
        ..
        samples        
        ..
        steam_admin    
        ..
        steam_howto    
            images         
            ..
        ..
        steam_trans    
        ..
        tip_sysconfig  
        ..
        tip_sysinstall 
            images         
            ..
        ..
    ..
    jiangxin       
        text           
            apache         
            ..
            config.network.linux
            ..
            db.mysql       
            ..
            db.oracle      
                Attic          
                ..
            ..
            dns.bind       
            ..
            email.qmail    
            ..
            kernel.linux   
            ..
            security.linux 
            ..
            security.ssh   
            ..
            utility.cvs    
            ..
            utility.samba  
            ..
            utility.xwindow
            ..
        ..
        web            
            Attic          
            ..
            doc            
            ..
            html           
                resources      
                ..
            ..
            images         
                gif            
                ..
                png            
                ..
                xpi            
                ..
                xpm            
                ..
            ..
            resource       
                html           
                ..
                ipaddr         
                ..
                mailaddr       
                ..
                pgpkey         
                ..
            ..
            utility        
                ltutil         
                ..
            ..
        ..
    ..
..

客户端目录结构

# mtree -cdin  -k type 

#          user: jiangxin
#       machine: openbsd
#          tree: /usr/home/jiangxin/work/test
#          date: Tue Sep 10 21:24:33 2002
/set type=dir
.              
    web            
        CVS            
        ..
        doc            
            CVS            
            ..
        ..
        docbook        
            CVS            
            ..
            project      
                CVS            
                ..
            ..
            docbook_howto  
                CVS            
                ..
            ..
            images         
                CVS            
                ..
                callouts       
                    CVS            
                    ..
                ..
            ..
            lession_scm    
                CVS            
                ..
            ..
            nightlybuild   
                CVS            
                ..
            ..
            pgp            
                CVS            
                ..
                images         
                    CVS            
                    ..
                ..
            ..
            pm_fw_diary_2_4
                CVS            
                ..
            ..
            pm_fw_module_debug
                CVS            
                ..
            ..
            pm_fw_plan_2_4 
                CVS            
                ..
            ..
            program_rules  
                CVS            
                ..
            ..
            rd_hwenv       
                CVS            
                ..
            ..
            steam_admin    
                CVS            
                ..
            ..
            steam_howto    
                CVS            
                ..
                images         
                    CVS            
                    ..
                ..
            ..
            steam_trans    
                CVS            
                ..
            ..
            tip_sysconfig  
                CVS            
                ..
            ..
            tip_sysinstall 
                CVS            
                ..
                images         
                    CVS            
                    ..
                ..
            ..
        ..
        html           
            CVS            
            ..
            resources      
                CVS            
                ..
            ..
        ..
        images         
            CVS            
            ..
            gif            
                CVS            
                ..
            ..
            png            
                CVS            
                ..
            ..
            xpi            
                CVS            
                ..
            ..
            xpm            
                CVS            
                ..
            ..
        ..
        resource       
            CVS            
            ..
            html           
                CVS            
                ..
            ..
            ipaddr         
                CVS            
                ..
            ..
            mailaddr       
                CVS            
                ..
            ..
            pgpkey         
                CVS            
                ..
            ..
        ..
        utility        
            CVS            
            ..
            ltutil         
                CVS            
                ..
            ..
        ..
    ..
..