Project

General

Profile

Download (1.84 KB) Statistics
| Branch: | Revision:
1
#!/bin/bash
2

    
3
if [[ -z $1 ]]
4
then
5
cat <<EOF
6
Usage: new-subgit-entry SVN_REPO_NAME"
7

    
8
  SVN_REPO_NAME: 
9
            the name of a subversion sub repository which is 
10
            found directly under  ^/trunk/SVN_REPO_NAME
11
EOF
12

    
13
  exit 0
14
fi
15

    
16
SVN_REPO_NAME=$1
17

    
18
SVN_REPO_FOLDER=/var/svn/edit
19
GIT_REPO_FOLDER=/var/git
20
GIT_USER=git
21

    
22
#
23
# perform checks
24
#
25
trunk_check=$(svn info http://dev.e-taxonomy.eu/svn/trunk/${SVN_REPO_NAME}/ | grep "Path: ${SVN_REPO_NAME}")
26
tags_check=$(svn info http://dev.e-taxonomy.eu/svn/tags/${SVN_REPO_NAME}/ | grep "Path: ${SVN_REPO_NAME}")
27
branches_check=$(svn info http://dev.e-taxonomy.eu/svn/branches/${SVN_REPO_NAME}/ | grep "Path: ${SVN_REPO_NAME}")
28

    
29
if [[ -z "$trunk_check" ]]
30
then 
31
  echo "ERROR: The subversion sub repository ${SVN_REPO_NAME} does not exist at http://dev.e-taxonomy.eu/svn/trunk/${SVN_REPO_NAME}"
32
  exit -1
33
fi
34
if [[ -z "$tags_check" ]]
35
then 
36
  echo "WARNING No tags folder for ${SVN_REPO_NAME} at http://dev.e-taxonomy.eu/svn/tags/${SVN_REPO_NAME}"
37
fi
38
if [[ -z "$branches_check" ]]
39
then 
40
  echo "ERROR: No branches folder for ${SVN_REPO_NAME} at  at http://dev.e-taxonomy.eu/svn/branches/${SVN_REPO_NAME}"
41
fi
42

    
43

    
44

    
45
cat <<EOF
46

    
47
Add the following git section to the /var/svn/edit/config/subgit.conf file:
48

    
49
--------------------------------------------------------------
50
[git "${SVN_REPO_NAME}"]
51
  translationRoot = /
52
  
53
  repository = ${GIT_REPO_FOLDER}/${SVN_REPO_NAME}.git
54
  pathEncoding = UTF-8
55
  
56
  trunk = trunk/${SVN_REPO_NAME}:refs/heads/master
57
  branches = branches/${SVN_REPO_NAME}/*:refs/heads/*
58
  shelves = shelves/${SVN_REPO_NAME}/*:refs/shelves/*
59
  tags = tags/${SVN_REPO_NAME}/*:refs/tags/*
60

    
61
  keepGitCommitTime = false
62
--------------------------------------------------------------
63

    
64
and run the following command afterwards:
65

    
66
  subgit install $SVN_REPO_FOLDER
67
  sudo chown -R git:git ${GIT_REPO_FOLDER}/${SVN_REPO_NAME}.git
68

    
69
EOF
(2-2/2)