9 echo "usage: ikiwiki-makerepo svn|git srcdir repository" >&2
10 echo " ikiwiki-makerepo bzr|mercurial srcdir" >&2
14 if [ -z "$rcs" ] || [ -z "$srcdir" ]; then
18 if [ ! -d "$srcdir" ]; then
19 echo "srcdir $srcdir not found" >&2
23 if [ "$rcs" != mercurial ] && [ "$rcs" != bzr ]; then
24 if [ -e "$repository" ]; then
25 echo "repository $repository already exists, aborting" >&2
28 repository="$(perl -e 'use Cwd q{abs_path}; $r=shift; $r=~s/\/*$//; print abs_path($r)' $repository)"
29 if [ -z "$repository" ]; then
30 echo "internal error finding repository abs_path" >&2
35 echo "Importing $srcdir into $rcs"
39 if [ -e "$srcdir/.svn" ]; then
40 echo "$srcdir already seems to be a svn working copy" >&2
43 svnadmin create "$repository"
44 svn mkdir "file://$repository/trunk" -m "create trunk directory"
46 svn co "file://$repository/trunk" .
47 svn propset svn:ignore ".ikiwiki" .
49 svn commit -m "initial import"
50 echo "Directory $srcdir is now a checkout of $rcs repository $repository"
53 # There are better ways to do this, but this works with older
55 mkdir -p "$repository"
56 (cd "$repository" && git --bare init --shared)
60 echo /.ikiwiki > .gitignore
61 echo /recentchanges >> .gitignore
63 git commit -m "initial commit"
64 git remote add origin "$repository"
65 git config branch.master.merge refs/heads/master
66 git config branch.master.remote origin
68 echo "Directory $srcdir is now a clone of $rcs repository $repository"
73 echo .ikiwiki > .hgignore
75 hg commit -m "initial import"
76 echo "Directory $srcdir is now set up as a mercurial repository"
81 echo .ikiwiki > .bzrignore
83 bzr commit -m "initial import"
84 echo "Directory $srcdir is now set up as a bzr repository"
87 echo "Unsupported revision control system $rcs" >&2