u-boot移植随笔(15):继续使用svn进行版本控制(合并分支实例) | 迟思堂工作室
当前位置: 首页 > U-Boot随笔 > 正文

u-boot移植随笔(15):继续使用svn进行版本控制(合并分支实例)

搞u-boot很久了,一直在用svn进行版本控制,感觉非常好。

不过我是最近才找到合并分支的方法,这里介绍一下。

首先说一下我的环境。

1、使用svn开发的模式:

所有开发都在分支进行,完成某一阶段时,将其合并到主干上,同时作一标签,即tag。svn_repos仓库中u-boot目录下有三个目录:trunk、branches、tags,分别保存主干代码、分支代码和标签。分支名称如u-boot-branch-xxx,标签名称如release-1.x_xxx。比如u-boot-branch-kernel表示这个分支主要任务是使用u-boot启动内核,release-1.2_i2c表示这个版本的i2c驱动已经没问题。等等。

2、路径使用环境变量UBOOT表示,实际路径为:

$ echo $UBOOT

/home/latelee/svn_repos/u-boot

3、网上找到的合并方法:

1):进入主干的svn目录;

2):首先查询出创建分支的开始版本;

3):使用svn merge命令合并分支;

4):使用svn commit -m “msg”。

4、u-boot背景:

已经完成了在u-boot添加对yaffs2文件系统的支持,下一步将u-boot从nand flash启动。因为使用source insight的缘故,当前目录为u-boot-2010.09(无论是什么版本)。

正文开始

1、查看修改:

[[email protected] u-boot-2010.09]$ svn st

M      include/linux/mtd/mtd.h

M      include/configs/smdk2440.h

M      common/cmd_nand.c

M      drivers/mtd/nand/nand_base.c

M      drivers/mtd/nand/nand_util.c

2、check in:

[[email protected] u-boot-2010.09]$ svn ci -m “add nand write.yaffs2 cmd,this version can boot kernel and rootfs”

正在发送       common/cmd_nand.c

正在发送       drivers/mtd/nand/nand_base.c

正在发送       drivers/mtd/nand/nand_util.c

正在发送       include/configs/smdk2440.h

正在发送       include/linux/mtd/mtd.h

传输文件数据…..

提交后的版本为 57。

由于我忘记了写version-log(文件名称就是version-log.txt)了,因此修改后再次提交:

[[email protected] u-boot-2010.09]$ svn ci -m “add info in version-log.txt”

正在发送       version-log.txt

传输文件数据.

提交后的版本为 58。

2、进入trunk目录(我的trunk目录与u-boot-2010.09在同一目录下):

[[email protected] u-boot-2010.09]$ cd ../trunk/

3、查看这个分支与trunk分离后所有的修改:

[[email protected] trunk]$ svn log -q –stop-on-copy file:///$UBOOT/branches/u-boot-branch-nand

————————————————————————

r58 | latelee | 2011-03-18 15:09:00 +0800 (五, 2011-03-18)

————————————————————————

r57 | latelee | 2011-03-18 15:05:49 +0800 (五, 2011-03-18)

————————————————————————

r56 | latelee | 2011-03-18 09:32:51 +0800 (五, 2011-03-18)

————————————————————————

r55 | latelee | 2011-03-14 08:25:00 +0800 (一, 2011-03-14)

————————————————————————

最下面的版本号就是创建分支开始的版本,下面就是使用这个版本号。

4、在主干上合并分支,注意HEAD和分支路径:

[[email protected] trunk]$ svn merge -r 55:HEAD file:///$UBOOT/branches/u-boot-branch-nand

U    version-log.txt

U    include/linux/mtd/mtd.h

U    include/configs/smdk2440.h

U    board/samsung/smdk2440/smdk2440.c

U    board/samsung/smdk2440/flash.c

U    common/cmd_nand.c

U    common/serial.c

U    arch/arm/include/asm/arch-s3c24x0/s3c24x0_cpu.h

A    arch/arm/include/asm/arch-s3c24x0/s3c2440.h

U    arch/arm/include/asm/arch-s3c24x0/s3c24x0.h

U    arch/arm/cpu/arm920t/s3c24x0/timer.c

U    drivers/mtd/nand/s3c2410_nand.c

A    drivers/mtd/nand/s3c2440_nand.c

U    drivers/mtd/nand/nand_base.c

U    drivers/mtd/nand/nand_util.c

U    drivers/mtd/nand/nand.c

U    drivers/mtd/nand/Makefile

U    drivers/i2c/s3c24x0_i2c.c

这里的s3c2440.h和s3c2440_nand.c前面的标志为“A”,表明这两个文件是新添加的,实际上,在这个版本提交前,我已经将它们入库了。这一点要注意。

5、提交:

[[email protected] trunk]$ svn ci -m “merge branch ‘nand’ to trunk”

正在发送       arch/arm/cpu/arm920t/s3c24x0/timer.c

增加           arch/arm/include/asm/arch-s3c24x0/s3c2440.h

正在发送       arch/arm/include/asm/arch-s3c24x0/s3c24x0.h

正在发送       arch/arm/include/asm/arch-s3c24x0/s3c24x0_cpu.h

正在发送       board/samsung/smdk2440/flash.c

正在发送       board/samsung/smdk2440/smdk2440.c

正在发送       common/cmd_nand.c

正在发送       common/serial.c

正在发送       drivers/i2c/s3c24x0_i2c.c

正在发送       drivers/mtd/nand/Makefile

正在发送       drivers/mtd/nand/nand.c

正在发送       drivers/mtd/nand/nand_base.c

正在发送       drivers/mtd/nand/nand_util.c

正在发送       drivers/mtd/nand/s3c2410_nand.c

增加           drivers/mtd/nand/s3c2440_nand.c

正在发送       include/configs/smdk2440.h

正在发送       include/linux/mtd/mtd.h

正在发送       version-log.txt

传输文件数据…………….

提交后的版本为 59。

到此,主干上的版本与分支上的版本一致。

6、将这个版本作一tag:

[[email protected] trunk]$ svn copy file:///$UBOOT/trunk file:///$UBOOT/tags/release-1.4_nand -m “tagging nand tag”

提交后的版本为 60。

提交后的版本为 60。

7、作分支:

[[email protected] trunk]$ svn copy file:///$UBOOT/trunk file:///$UBOOT/branches/u-boot-branch-nandboot -m “branch ‘nandboot’ for booting u-boot from nand flash”

提交后的版本为 61。

8、检出(注意,最后处名称为u-boot-2010.09,主要是方便使用source insight):

[latel[email protected] my2440]$ svn co file:///$UBOOT/branches/u-boot-branch-nandboot u-boot-2010.09

.

.

.

(这里省略N行)

A    u-boot-2010.09/examples/api/libgenwrap.c

A    u-boot-2010.09/examples/api/Makefile

A    u-boot-2010.09/examples/api/glue.c

取出版本 61。

前面的是我的习惯:完成某一阶段的移植,作标签、作分支,检出分支,在分支上修改,不动主干。这称为“阶段性胜利”。

现在,u-boot-2010.09目录就是要进行下一步修改的目录了,它位于分支u-boot-branch-nandboot上。在u-boot-2010.09目录的.svn目录下entries文件中出现:

dir

61

file:///home/latelee/svn_repos/u-boot/branches/u-boot-branch-nandboot

file:///home/latelee/svn_repos

说明这的确是在这个分支上。

山人于2011-03-22

近来经济拮据,如本文对阁下有帮助,可慷慨解囊赞助笔者以输出更多好文章。
支付宝[email protected] 或 微信fly_camel_fly 均可。感谢!
14373903313201                                  14373903313202

本文固定链接: /porting-uboot/u-boot-porting-svn-again.html

目前暂无评论

发表评论

*

快捷键:Ctrl+Enter