]> git.donarmstrong.com Git - zsh.git/blob - .zsh/func/svngit
add ~/.local/bin to PATH
[zsh.git] / .zsh / func / svngit
1 #!/bin/sh
2 #
3 # func/svngit
4 #
5 # one-time conversion of SVN repositories to Git repositories
6 #
7 # Copyright © 2006–2009 martin f. krafft <madduck@madduck.net>
8 # Released under the terms of the Artistic Licence 2.0
9 #
10 # Source repository: git://git.madduck.net/etc/zsh.git
11 #
12
13 local svnrepo dest args
14 args=()
15
16 for arg in "$@"; do
17   case "$arg" in
18     (svn+*|svn://|http://)
19       if [[ -z $svnrepo ]]; then
20         svnrepo="$arg"
21       else
22         echo "E: SVN repository multiply defined." >&2
23         exit 1
24       fi
25       ;;
26     (*)
27       if [[ -e $dest ]]; then
28         if [[ -d $dest ]] && [[ -z $svnrepo ]] && svn info $svnrepo >/dev/null 2>&1; then
29           svnrepo="$arg"
30         else
31           echo "E: destination $dest already exists." >&2
32           exit 1
33         fi
34       fi
35       if [[ -z $dest ]]; then
36         dest="$arg"
37       else
38         args+="$arg"
39       fi
40       ;;
41   esac
42 done
43
44 git svn clone --no-metadata $args "$svnrepo" "$dest"
45
46 cd "$dest/.git"
47
48 test -d svn && rm -r svn
49 rm -rf **/git-svn*
50
51 cd -