Mercurial > dotfiles
comparison .shell.d/50.vcs_functions.sh @ 133:5b0b8ad2cb2c
vcs_functions: some versions of the shell don't like - in function names.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Tue, 18 Aug 2009 10:13:19 -0500 |
parents | 1286c27cf0c0 |
children | 59ea03d7029a |
comparison
equal
deleted
inserted
replaced
132:82fd8ff94de8 | 133:5b0b8ad2cb2c |
---|---|
6 ( wcroot ; | 6 ( wcroot ; |
7 hg -R .hg/patches $@ | 7 hg -R .hg/patches $@ |
8 ) | 8 ) |
9 } | 9 } |
10 | 10 |
11 function ez-svn-sync() { | 11 function ezsvnsync() { |
12 local url | 12 local url |
13 local repo | 13 local repo |
14 repo=$1 | 14 repo=$1 |
15 url=$2 | 15 url=$2 |
16 svnadmin create $repo | 16 svnadmin create $repo |
18 echo 'exit 0' >> $repo/hooks/pre-revprop-change | 18 echo 'exit 0' >> $repo/hooks/pre-revprop-change |
19 chmod +x $repo/hooks/pre-revprop-change | 19 chmod +x $repo/hooks/pre-revprop-change |
20 svnsync init file://`pwd`/$repo $url | 20 svnsync init file://`pwd`/$repo $url |
21 svnsync sync file://`pwd`/$repo | 21 svnsync sync file://`pwd`/$repo |
22 } | 22 } |
23 alias ez-svn-sync=ezsvnsync | |
23 | 24 |
24 # Function to grab the url of an svn wc | 25 # Function to grab the url of an svn wc |
25 function svnurlof() { | 26 function svnurlof() { |
26 local url | 27 local url |
27 url=`svn info $1 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` | 28 url=`svn info $1 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` |
40 echo -n 'No repo found (tried svn, git-svn, hgsvnclient)' | 41 echo -n 'No repo found (tried svn, git-svn, hgsvnclient)' |
41 fi | 42 fi |
42 echo $url | 43 echo $url |
43 } | 44 } |
44 | 45 |
45 function hg-svn-merge-branch() { | 46 function hgsvnmergebranch() { |
46 local targetrev | 47 local targetrev |
47 local striprev | 48 local striprev |
48 targetrev=$(hg id | cut -d ' ' -f 1) | 49 targetrev=$(hg id | cut -d ' ' -f 1) |
49 hg merge $1 | 50 hg merge $1 |
50 hg ci -m "Merging $1" | 51 hg ci -m "Merging $1" |
51 striprev=$(hg id | cut -d ' ' -f 1) | 52 striprev=$(hg id | cut -d ' ' -f 1) |
52 hg co $targetrev | 53 hg co $targetrev |
53 hg diff -r$targetrev:$striprev | hg import - -m "Merged branch $1." | 54 hg diff -r$targetrev:$striprev | hg import - -m "Merged branch $1." |
54 hg strip $striprev | 55 hg strip $striprev |
55 } | 56 } |
56 | 57 alias hg-svn-merge-branch=hgsvnmergebranch |
57 function hg-svn-rebase-all() { | 58 |
59 function hgsvnrebaseall() { | |
58 for b in `hg log -u 'Augie Fackler <durin42@gmail.com>' --template '{branches}\n' | sort | uniq` | 60 for b in `hg log -u 'Augie Fackler <durin42@gmail.com>' --template '{branches}\n' | sort | uniq` |
59 do | 61 do |
60 echo "rebase $b" | 62 echo "rebase $b" |
61 hg co $b | 63 hg co $b |
62 if [[ "$?" != "0" ]] ; then | 64 if [[ "$?" != "0" ]] ; then |
69 else | 71 else |
70 echo "Skip $b since it has a merge." | 72 echo "Skip $b since it has a merge." |
71 fi | 73 fi |
72 done | 74 done |
73 } | 75 } |
74 | 76 alias hg-svn-rebase-all=hgsvnrebaseall |
75 function hg-ammend() { | 77 |
78 function hgamend() { | |
76 hg qimport -r . && hg qref && hg qfin qtip | 79 hg qimport -r . && hg qref && hg qfin qtip |
77 } | 80 } |
78 | 81 alias hg-amend=hgamend |
79 function hg-svn-mkbranch() { | 82 |
83 function hgsvnmkbranch() { | |
80 local upstream | 84 local upstream |
81 upstream=$(hg paths default | sed 's%/*$%%') | 85 upstream=$(hg paths default | sed 's%/*$%%') |
82 local branchname | 86 local branchname |
83 if [ "x$1" = "x" ] ; then | 87 if [ "x$1" = "x" ] ; then |
84 echo 'Must provide new branch name.' | 88 echo 'Must provide new branch name.' |
99 }'` | 103 }'` |
100 | 104 |
101 branchname=$br | 105 branchname=$br |
102 echo svn cp $upstream/$branchname $upstream/branches/$1 | 106 echo svn cp $upstream/$branchname $upstream/branches/$1 |
103 } | 107 } |
108 alias hg-svn-mkbranch=hgsvnmkbranch | |
104 | 109 |
105 # Function to clean locks out of svn wcs | 110 # Function to clean locks out of svn wcs |
106 function clean_svn_source_trees() { | 111 function clean_svn_source_trees() { |
107 for aa in */ ; do | 112 for aa in */ ; do |
108 pushd $aa > /dev/null | 113 pushd $aa > /dev/null |