HOW TO: Using CVS

本文详细介绍了Cvs命令的使用方法,包括环境变量设置、仓库初始化、项目导入与导出、文件签出与提交、冲突解决、文件特性、标记使用等核心操作流程。同时提供了版本控制系统的实践技巧,帮助开发者高效管理和协同开发。

本文出自 “ 凌辉” 博客,出处 http://tianli.blog.51cto.com/190322/32266

机器的环境变量
CVSROOT=:pserver:administrator:lili00okok@211.68.87.141:2401/Repository
cvsNT配置
如图cvsnt.bmp,cvsnt2.bmp
                                     cvsnt.bmp
                           cvsnt2.bmp
 
把cvs命令添加到系统的path
cvs -v 检查是否安装了cvs -v version
创建一个仓库 -d destination
unix cvs -d /home/repository init
windows cvs -d c:\repository init
导入项目
cvs import project_name vendor_tag release_tag
cvs import -m""  sesame sesame initial
签出项目
cvs co sesame
查看文件状态
cvs status color.txt
查看本地文件和仓库中的差别
cvs diff --side-by-side -rHEAD color.txt >D:\a.txt
提交修改
cvs commit -m"Client wants 4 more colors!"
查看历史记录 -r revision
cvs log -r1.5 color.txt
冲突解决办法1
cvs update 更新本地副本
cvs commit
冲突解决办法2
cvs update
<<<<本地的内容
ichi
=======
uno
>>>>>>>>1.5仓库的代码
签出文件  
cvs checkout client server
按照模块
cvs co client/template
按照版本号
cvs co -r REL_1_3 client
按照日期-D by Date
cvs co -D 2003-06-04 client
更改签出目录-d target Directory
cvs co -r EEL_1_34 -d rell client
更新包括新添加的文件
cvs update -d
有选择的更新
cvs update File1.java template
减少更新输出 -q 在update 之前
cvs -q update -d
全局命令   局部命令 -q quiet
cvs -q -d /usr/repository checkout -d temp
添加文件夹
cvs add timelib
添加文件
cvs add Time.java
添加二进制文件 -kb keyword binary
cvs add -kb DataFormat.doc
提交之前发现二进制文件错误
cvs remove DataFormat.doc
cvs add -kb DataFormat.doc
提交之后发现错误
--修改仓库标志
cvs admin -kb DataFormat.doc
--重置本地工作副本标志
cvs update -A DataFormat.doc
--复制一个正确的文件覆盖这个文件
cp  ../DataFormat.doc DataFormat.doc
--提交
cvs commit -m"reset -kb flag"
文件特性cvswrappers
 
--导入文件时使用-W define Wrapper
cvs import -W "*.jar -k 'b'" -W"*.doc -k 'b'" -m""
--使用cvswraper
cvs co CVSROOT
编辑cvswrappers文件添加
*.jar -k 'b'
*.doc -k 'b'
释放本地工作区的同时删除文件
cvs release -d CVSROOT
忽略一个目录下的文件
cvs add .cvsignore
重新命名文件
mv contacts.java contactmgr.java
--删除仓库中的文件
cvs remove contacts.java
--添加一个新的文件
cvs add contactmgr.java
cvs commit -m""
--如果添加一个相同名字的文件版本号不是从1.1开始
--clearAllFlags -A标志清楚所有的标记,并且把指定文件的状态恢复到河仓库文件的状态一直
cvs update -A

重新命名目录
--创建新目录,把旧目录的文件移到新目录,添加新目录,添加新目录下的文件 提交
--更新的时候带 -P prune directories
cvs update -P
查看修改了什么
--本地文件与本地副本最新文件的差别
cvs diff File1.java =
--本地文件与仓库最新文件的差别
cvs diff -rHEAD file1.java
--本地文件与指定版本的差别
cvs diff -r1.1 file1.java
--两个版本之间的差别
cvs diff -r1.1 -r1.2 file1.java
--context diff
cvs diff -c file1.java
--side-by-side
cvs diff --side-by-side file1.java
diff and patch
--u unified diff
cvs diff -u >diff.list
--patch
patch -p0 <diff.list
处理变更冲突
--删除本地副本,重新更新
--保存文件重新提交
--移出标记然后提交
检查变更历史
cvs log file1.java
cvs log -r 1.2 -r 1.4 file
cvs log -d "2 days ago" -d today
逐行的历史记录
cvs annotate file.java
cvs ann file.java
cvs ann -r file.java
cvs ann -D file.java
移除修改
cvs log file1.java
cvs diff -c -r1.3 -r1.4 file1.java
-- -j join from  使用相反的顺序指定版本号 计算从高版本到低版本需要的修改,应用到本地副本
cvs update -j1.4 -j1.3
cvs update -j after_change -j before_change
--提交变更
cvs commit
7.标记的使用
7.1发布标记
Release branch BR_rel BR_1_0
cvs rtag -b BR_1_0 project
分支中工作
cvs  co -r BR_1_0 -d br1.0 project
7.2生成发布版本
Release REL_rel REL_1_0
cvs tag REL_1_0
cvs co -r REL_1_0 -d rel1.0 project
7.3发布程序中修复程序缺陷
Pre bug fix PRE_track PRE_13145
Post bug fix POST_track POST_13145
签出文件
cvs co -r BR_1_0 -d br1.0 project
标记
cvs tag PRE_1234
cvs commit -m "Fix PRE1234"
标记
cvs tag POST_1234
切换主干
cd project
cvs update
合并发布版本的缺陷到主干代码
cvs -j PRE_1234 -j POST_1234 update
cvs commit -m"Apply fix for PR1234 from BR1.0"
7.4实验性分支
Deploper TRY_initial_yymmdd TRY_DT_030631
Experiment        TRY_AH_030631
cvs commit-m""
创建发布分支
cvs rtag -b TRY_DT_030925 project
更新文件
cvs update -r TRY_DT_030925
清除其他的标记
cvs update -A
cvs co -r TRY_DT_092503 -d project_exp project
合并实验分支到主干代码
合并之前都要转到相应的主干代码中合并一个分支中所有的代码稍微有点不同
cvs update -j TRY_DT_092503
8创建初始项目
8.1导入项目
cvs import -m"" wibble wibble initial
                名称    开发商 开发商版本号
顶级目录结构
顶级目录中的文件
1.readme文件 要解决的商业问题,运用得基本技术
2.building 包含一些简单的指示,告诉人们怎么构建项目
3.glossary 术语表
顶级目录
doc/所有项目文档,备忘录电子邮件 doc/bibliography参考书目
data/要填充到数据库的数据
db/与schema 有关的所有数据 对于每次更新,
 让数据库管理员创建sql更新脚本,这个脚本既要更新schema也能够迁移数据
src/项目的原文件
util/各种项目专用的实用程序工具以及脚本程序,tools/
vendor/第三方库或者头文件
vendorsrc/第三方的库的原代码
wibble
  |
  |-readme
  |-building
  |-glosarry
  |-doc/
  |-data/
  |-db/
  |-src/
  |-util/
  |-vendor/
  |-vendorsrc/ 
 
9使用模块
 划分子项目
  竖直划分:客户端,服务器端
  水平划分:数据库代码,计算模块,外部系统接口
 cvs co CVSROOT
 modules
 
 alias 模块
 client -a proj1/client
 
 cvs co client
 得到的是
 project1/client
 
 regular模块
 
 clnt proj1/client half/sample
 cvs co clnt
 
 得到的目录是
 clnt/
 内容是两个目录的综合
 
 ampersan模块
 halfruby half/sample
 fullruby full/sample
 allruby &halfruby &fullruby
 
  得到的目录是
 allruby
  |-halfruby
  |-fullruby
 
 带有原代码的库
 --导入开发商新发布的版本
 -ko keyword off
 cvs import -ko -m"" vendorsrc/fsf/readline FDF_RL RL_4_4
 
 升级版本导入
 cvs import -ko -m"" vendorsrc/fsf/readline FDF_RL RL_4_5
 本次导入相当于是更新
 
 合并修改
 cvs co -jRL_4_4 -jRL_4_5 vendorsrc/fsf/readline
 
 cvs commit -m""
 
 几个主要的步骤:
 1.导入开发商的代码:
  cvs import -ko -m"load" vendor_module vendor release_tag
 2.签出开发商代码到一个本地工作区
  cvs co vendor_module
 3.修改并提交修改的结果
  cvs commit -m"summary of changes"
 4.导入一个新的版本 
  cvs import -ko "update" vendor_module vendor release_tag
 5.解决开发商发布的新版本和我们修改的代码之间的冲突:
  cvs co -jrelease_1 -jreleae_2 vendor_module
 6.将修改的代码保存到仓库
  cvs commit -m"summary of changes"

本文出自 “凌辉” 博客,请务必保留此出处http://tianli.blog.51cto.com/190322/32266


Building a Busybox Boot Floppy ============================== This document describes how to buid a boot floppy using the following components: - Linux Kernel (http://www.kernel.org) - uClibc: C library (http://www.uclibc.org/) - Busybox: Unix utilities (http://busybox.net/) - Syslinux: bootloader (http://syslinux.zytor.com) It is based heavily on a paper presented by Erik Andersen at the 2001 Embedded Systems Conference. Building The Software Components -------------------------------- Detailed instructions on how to build Busybox, uClibc, or a working Linux kernel are beyond the scope of this document. The following guidelines will help though: - Stock Busybox from CVS or a tarball will work with no modifications to any files. Just extract and go. - Ditto uClibc. - Your Linux kernel must include support for initrd or else the floppy won't be able to mount it's root file system. If you require further information on building Busybox uClibc or Linux, please refer to the web pages and documentation for those individual programs. Making a Root File System ------------------------- The following steps will create a root file system. - Create an empty file that you can format as a filesystem: dd if=/dev/zero of=rootfs bs=1k count=4000 - Set up the rootfs file we just created to be used as a loop device (may not be necessary) losetup /dev/loop0 rootfs - Format the rootfs file with a filesystem: mkfs.ext2 -F -i 2000 rootfs - Mount the file on a mountpoint so we can place files in it: mkdir loop mount -o loop rootfs loop/ (you will probably need to be root to do this) - Copy on the C library, the dynamic linking library, and other necessary libraries. For this example, we copy the following files from the uClibc tree: mkdir loop/lib (chdir to uClibc directory) cp -a libc.so* uClibc*.so \ ld.so-1/d-link/ld-linux-uclibc.so* \ ld.so-1/libdl/libdl.so* \ crypt/libcrypt.so* \ (path to)loop/lib - Install the Busybox binary and accompanying symlinks: (chdir to busybox directory) make CONFIG_PREFIX=(path to)loop/ install - Make device files in /dev: This can be done by running the 'mkdevs.sh' script. If you want the gory details, you can read the script. - Make necessary files in /etc: For this, just cp -a the etc/ directory onto rootfs. Again, if you want all the details, you can just look at the files in the dir. - Unmount the rootfs from the mountpoint: umount loop - Compress it: gzip -9 rootfs Making a SYSLINUX boot floppy ----------------------------- The following steps will create the boot floppy. Note: You will need to have the mtools package installed beforehand. - Insert a floppy in the drive and format it with an MSDOS filesystem: mformat a: (if the system doesn't know what device 'a:' is, look at /etc/mtools.conf) - Run syslinux on the floppy: syslinux -s /dev/fd0 (the -s stands for "safe, slow, and stupid" and should work better with buggy BIOSes; it can be omitted) - Put on a syslinux.cfg file: mcopy syslinux.cfg a: (more on syslinux.cfg below) - Copy the root file system you made onto the MSDOS formatted floppy mcopy rootfs.gz a: - Build a linux kernel and copy it onto the disk with the filename 'linux' mcopy bzImage a:linux Sample syslinux.cfg ~~~~~~~~~~~~~~~~~~~ The following simple syslinux.cfg file should work. You can tweak it if you like. ----begin-syslinux.cfg--------------- DEFAULT linux APPEND initrd=rootfs.gz root=/dev/ram0 TIMEOUT 10 PROMPT 1 ----end-syslinux.cfg--------------- Some changes you could make to syslinux.cfg: - This value is the number seconds it will wait before booting. You can set the timeout to 0 (or omit) to boot instantly, or you can set it as high as 10 to wait awhile. - PROMPT can be set to 0 to disable the 'boot:' prompt. - you can add this line to display the contents of a file as a welcome message: DISPLAY display.txt Additional Resources -------------------- Other useful information on making a Linux bootfloppy is available at the following URLs: http://www.linuxdoc.org/HOWTO/Bootdisk-HOWTO/index.html http://www.linux-embedded.com/howto/Embedded-Linux-Howto.html http://linux-embedded.org/howto/LFS-HOWTO.html http://linux-embedded.org/pmhowto.html http://recycle.lbl.gov/~ldoolitt/embedded/ (Larry Doolittle's stuff) Possible TODOs -------------- The following features that we might want to add later: - support for additional filesystems besides ext2, i.e. minix - different libc, static vs dynamic loading - maybe using an alternate bootloader
最新发布
10-23
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值