forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhg-functions
39 lines (31 loc) · 1.06 KB
/
hg-functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
if [ -f ${BASH_SOURCE%/*}/../.git/config ]; then
# You always want to do rebase pulls.
alias pull='git pull --rebase'
# You always want to pull before pushing, to avoid spurious collisions.
alias push='pull && git push'
# Commits, and prepends the current directory name to the commit message.
# Just pass it the commit message as an argument.
function save {
local msg=$1; shift
git commit -a -m "[${PWD##*/}] ${msg}" $*
}
elif [ -f ${BASH_SOURCE%/*}/../.hg/hgrc ]; then
# You always want to do rebase pulls.
alias pull='hg pull --rebase'
# You always want to pull before pushing, to avoid spurious collisions.
alias push='pull && hg push'
# Commits, and prepends the current directory name to the commit message.
# Just pass it the commit message as an argument.
function save {
local msg=$1; shift
hg commit -m "[${PWD##*/}] ${msg}" $*
}
# Regens, commits, and pulls/pushes, all in one package.
# Pass it the commit message as an argument.
function rcommit {
regenerate && save "${1}" . && push
}
else
echo "Neither .git nor .hg found"
exit 1
fi