forked from Dolibarr/dolibarr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git2cvs.sh
executable file
·59 lines (49 loc) · 1.58 KB
/
git2cvs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
######################################################################
#
# git2cvs
#
# Commit git commits to CVS.
#
# See:
# http://vwelch.blogspot.com/2009/10/using-git-with-cvs-repository.html
#
######################################################################
# Exit on any error
#set -e
# Tag name used to indicate last commit exported to CVS
tag_name="CVS-LAST-EXPORT-3.1"
branch="3.1"
export CVS_DIR="/media/DATA/Mes Developpements/dolibarroldcvs"
export GIT_DIR="/home/ldestail/git/dolibarrold/.git"
cd "$CVS_DIR"
# Load name of git directory from ./.git-dir
if test -f .git-dir ; then
export GIT_DIR=`cat ./.git-dir`
fi
echo "GIT_DIR is ${GIT_DIR}"
# Sanity check: look for tag
git tag | grep ${tag_name} > /dev/null
if test $? -ne 0 ; then
echo "Did not find expected tag ${tag_name} in git repository."
exit 1
fi
echo "Getting list of commits since last export..."
# 'cut' remove log message, leaving commit id
# 'tail -r' reverses to commits in chronological order
# git log --pretty=oneline 644b496732.. 3.1-beta | cut -f 1 -d " " | tac
commits=`git log --pretty=oneline ${tag_name}.. ${branch} | cut -f 1 -d " " | tac`
num_commits=`echo ${commits} | wc -w`
echo "Found ${num_commits} commits."
for commit in ${commits} ; do
echo "Commiting ${commit} to CVS: git cvsexportcommit -c -v ${commit}"
# It would be nice to display commit message here, but I can't
# figure out how to do it.
git cvsexportcommit -c -v ${commit}
echo "Result=$?"
echo "Moving tag..."
git tag -f ${tag_name} ${commit}
read ligne
done
echo "Success."
exit 0