]> git.madduck.net Git - etc/zsh.git/blob - .zsh/func/svngit

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

use slexy as pastebin
[etc/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 -