]>
Commit | Line | Data |
---|---|---|
7e37b984 | 1 | # shell aliases and functions for PLD Developer |
6657c577 | 2 | # $Id$ |
7e37b984 | 3 | |
7e37b984 ER |
4 | alias cv='cvs status -v' |
5 | alias ac='poldek -q --sn ac --cmd' | |
6 | alias ac-requires='ac what-requires' | |
7 | alias ac-provides='ac what-provides' | |
8d51d899 | 8 | alias ac-verify='poldek --sn ac --sn ac-ready -V' |
7e37b984 | 9 | alias ac-tag='./builder -cf -T AC-branch -r HEAD' |
7e37b984 ER |
10 | alias adif="dif -x '*.m4' -x ltmain.sh -x install-sh -x depcomp -x 'Makefile.in' -x compile -x 'config.*' -x configure -x missing -x mkinstalldirs" |
11 | alias pclean="sed -i~ -e '/^\(?\|=\+$\|unchanged:\|diff\|only\|Only\|Files\|Common\|Index:\|RCS file\|retrieving\)/d'" | |
12 | ||
13 | # merges two patches | |
14 | # requires: patchutils | |
15 | pmerge() { | |
16 | combinediff -p1 $1 $2 > m.patch || return | |
17 | pclean m.patch | |
18 | dif $1 m.patch | |
19 | } | |
20 | ||
21 | # makes diff from PLD CVS urls | |
22 | urldiff() { | |
23 | local url="$1" | |
24 | if [ -z "$url" ]; then | |
25 | echo >&2 "Reading STDIN" | |
26 | read url | |
27 | fi | |
28 | ||
29 | echo >&2 "Process $url" | |
30 | local file="$url" | |
31 | file=${file#*SPECS/} | |
32 | file=${file#*SOURCES/} | |
33 | file=${file##*/} | |
34 | local r1=${file#*r1=} | |
35 | local r2=${r1#*r2=} | |
36 | r2=${r2%&*} | |
37 | r1=${r1%%&*} | |
38 | file=${file%\?*} | |
39 | ||
40 | echo >&2 "$file: $r1 -> $r2" | |
41 | cvs diff -u -r$r1 -r$r2 $file | tee m.patch | diffcol | |
42 | } | |
43 | ||
44 | # downloads sourceforge url from specific mirror | |
45 | sfget() { | |
46 | local url="$1" | |
47 | url="${url%?download}" | |
48 | url="http://dl.${url#http://prdownloads.}" | |
49 | # use mirror | |
50 | local mirror="http://nchc.dl.sourceforge.net" | |
51 | url="$mirror/sourceforge/${url#http://dl.sourceforge.net/}" | |
52 | wget -c "$url" | |
53 | } | |
54 | ||
55 | # displays latest used tag for a specfile | |
56 | autotag() { | |
57 | local out | |
58 | for a in "$@"; do | |
59 | out=$(cvs status -v $a | awk '/auto-ac-/{if (!a++) print $1}') | |
60 | echo "$a:$out" | |
61 | done | |
62 | } | |
88e7bbe5 ER |
63 | |
64 | dif() { | |
65 | if [ -t 1 ]; then | |
66 | diff -ur "$@" | diffcol | less -R | |
67 | else | |
68 | diff -ur "$@" | |
69 | fi | |
70 | } | |
71 | ||
72 | diffcol() { | |
73 | sed -e ' | |
74 | s,\e,\e[44m^[\e[49m,g; | |
75 | s,\a,\e[44m^G\e[49m,g; | |
76 | s,^\(Index:\|diff\|---\|+++\) .*$,\e[32m&,; | |
77 | s,^@@ ,\e[33m&,; | |
78 | s,^-,\e[35m&,; | |
79 | s,^+,\e[36m&,; | |
80 | s,\r,\e[44m^M\e[49m,g; | |
81 | s, , ,g; | |
82 | s,\([^[:space:]]\)\([[:space:]]\+\)$,\1\e[41m\2\e[49m,g; | |
83 | s,$,\e[0m, | |
84 | ' "$@" | |
85 | } |