]> gitweb.pimeys.fr Git - config-20-100.git/blob - .zsh/rc/extra/02_mercurial
Ajout du zshrc, même s'il manque encore de commentaires etc.
[config-20-100.git] / .zsh / rc / extra / 02_mercurial
1 #!/bin/zsh
2
3 # mercurial related stuff {{{
4 if check_com -c hg ; then
5 # gnu like diff for mercurial
6 # http://www.selenic.com/mercurial/wiki/index.cgi/TipsAndTricks
7 #f5# GNU like diff for mercurial
8 hgdi() {
9 emulate -L zsh
10 for i in $(hg status -marn "$@") ; diff -ubwd <(hg cat "$i") "$i"
11 }
12
13 # build debian package
14 #a2# Alias for \kbd{hg-buildpackage}
15 alias hbp='hg-buildpackage'
16
17 # execute commands on the versioned patch-queue from the current repos
18 alias mq='hg -R $(readlink -f $(hg root)/.hg/patches)'
19
20 # diffstat for specific version of a mercurial repository
21 # hgstat => display diffstat between last revision and tip
22 # hgstat 1234 => display diffstat between revision 1234 and tip
23 #f5# Diffstat for specific version of a mercurial repos
24 hgstat() {
25 emulate -L zsh
26 [[ -n "$1" ]] && hg diff -r $1 -r tip | diffstat || hg export tip | diffstat
27 }
28
29 #f5# Get current mercurial tip via hg itself
30 gethgclone() {
31 emulate -L zsh
32 setopt errreturn
33 if [[ -f mercurial-tree/.hg ]] ; then
34 cd mercurial-tree
35 echo "Running hg pull for retreiving latest version..."
36 hg pull
37 echo "Finished update. Building mercurial"
38 make local
39 echo "Setting \$PATH to $PWD:\$PATH..."
40 export PATH="$PWD:$PATH"
41 else
42 echo "Downloading mercurial via hg"
43 hg clone http://selenic.com/repo/hg mercurial-tree
44 cd mercurial-tree
45 echo "Building mercurial"
46 make local
47 echo "Setting \$PATH to $PWD:\$PATH..."
48 export PATH="$PWD:$PATH"
49 echo "make sure you set it permanent via ~/.zshrc if you plan to use it permanently."
50 # echo "Setting \$PYTHONPATH to PYTHONPATH=\${HOME}/lib/python,"
51 # export PYTHONPATH=${HOME}/lib/python
52 fi
53 }
54
55 fi # end of check whether we have the 'hg'-executable
56
57 # get current mercurial snapshot
58 #f5# Get current mercurial snapshot
59 gethgsnap() {
60 emulate -L zsh
61 setopt errreturn
62 if [[ -f mercurial-snapshot.tar.gz ]] ; then
63 echo "mercurial-snapshot.tar.gz exists already, skipping download."
64 else
65 echo "Downloading mercurial snapshot"
66 wget http://www.selenic.com/mercurial/mercurial-snapshot.tar.gz
67 fi
68 echo "Unpacking mercurial-snapshot.tar.gz"
69 tar zxf mercurial-snapshot.tar.gz
70 cd mercurial-snapshot/
71 echo "Installing required build-dependencies"
72 $SUDO apt-get update
73 $SUDO apt-get install python2.4-dev
74 echo "Building mercurial"
75 make local
76 echo "Setting \$PATH to $PWD:\$PATH..."
77 export PATH="$PWD:$PATH"
78 echo "make sure you set it permanent via ~/.zshrc if you plan to use it permanently."
79 }