Using cvs, patch and diff

Using patch / diff

Patch/diff are wonderful tools, however people often provide data that confuses them in a messy and difficult to un-tangle sort of a way. Here are some hints on untangling the mess:

  • When creating diffs, please use diff -upN to create a diff against the revision(s) you checked out.
    The options used are:
    -u
    Create unified context diff.
    Chances are much higher that the patch reviewer sees what it is about and is able to apply the patch to code that changed in the meantime.
    -p
    Show which C function each change is in.
    Just informational, be nice to the patch reviewer.
    -N
    New file, treat absent files as empty,
    which effectively includes new files in your diff that otherwise would be missing.
  • If at all unsure, run patch with --dry-run first, this will appear to do the patching action, but not actually do it [ this can give bogus results with compound inter-depending patches, but is extremely useful ].
  • Mostly use patch -p0; 0 signifies the number of path elements to strip from the beginning of the file path the diff points at.
  • When you mess up, and have 1/2 of the patch applied and want to revert to clean, either remove the files and cvs update, or re-patch with the '-R' option, to reverse the effect.
  • Sometimes using diff between modules with lots of whitespace changes makes the patch hard to read; the '-w' flag to (cvs) diff makes this easier.

Before committing a patch to ooo-build, test it with make patch.apply in the top-level, NB. it really pays to have 2 copies of the tree - 1 hacked, 1 pristine.

[ edit]

Make clean

Just use dmake clean in the build/src680 directory. Or for a more descructive version in ooo-build try rm -Rf build.

[ edit]

CVS setup

In order to make efficient use of bandwidth, generate sensible diffs by default, and follow the trend, you need this in your ~/.cvsrc.

cvs -z3 -q
diff -upN
update -dP
checkout -P
status -v

Reference
http://wiki.services.openoffice.org/wiki/Tips

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值