Changes between Version 4 and Version 5 of CommittersTipsAndTricks
- Timestamp:
- Jun 2, 2008, 1:18:27 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CommittersTipsAndTricks
v4 v5 22 22 == Apply patches directly from Trac URL == 23 23 24 === Installation === 24 25 Add the following functions to your `.bashrc` in order to apply patches directly from Trac. 25 26 … … 30 31 31 32 function trac-patch { 32 trac-get $1 || return 33 patch -p0 < $(basename $1) 33 local cmd="" 34 while [[ $1 == -* ]]; do 35 if [[ "$1" == "--" ]]; then 36 break 37 fi 38 39 cmd="$cmd $1" 40 shift 41 done 42 43 if [[ -z $cmd ]]; then 44 cmd="-p0" 45 fi 46 47 trac-get $1 48 patch $cmd < $(basename $1) 34 49 } 35 50 }}} 51 52 === Usage === 36 53 37 54 Use like this: … … 45 62 $ trac-patch http://trac.macports.org/attachment/ticket/.../Portfile.diff 46 63 }}} 64 65 You can also add options which will get passed through to the patch tool. This is especially useful when the patch needs another prefix level. 66 {{{ 67 $ trac-patch -p1 http://trac.macports.org/attachment/ticket/.../Portfile.diff 68 }}} 69 If you don't add any option, `-p0` is used as a default. This should be the most common case.