* src/svn-to-git/convert-lrde-seminars-to-git: New.
Used to generated the a `csi-seminar' Git repository.
* src/svn-to-git/svn-to-git: Rename variable `path' as `ext_path',
as `path' might be a special variable to the shell (e.g., in Zsh).
By symmetry, rename `url' and `url_hash' as `ext_url' and
`ext_url_hash'.
* src/svn-to-git/authors-lrde.full (aseure): New author.
git-svn-id:
https://svn.lrde.epita.fr/perso/roland/trunk@823
be833968-19e8-472b-b5c8-4bceb4e44ec7
---
src/svn-to-git/authors-lrde.full | 1 +
src/svn-to-git/convert-lrde-seminars-to-git | 52 +++++++++++++++++++++++++++
src/svn-to-git/svn-to-git | 12 +++----
3 files changed, 59 insertions(+), 6 deletions(-)
create mode 100755 src/svn-to-git/convert-lrde-seminars-to-git
diff --git a/src/svn-to-git/authors-lrde.full b/src/svn-to-git/authors-lrde.full
index bfc3ce0..7d519d9 100644
--- a/src/svn-to-git/authors-lrde.full
+++ b/src/svn-to-git/authors-lrde.full
@@ -9,6 +9,7 @@ alban = Alban Linard <alban(a)lrde.epita.fr>
angeli_a = Alexis Angelidis <angeli_a(a)lrde.epita.fr>
anisko_r = Robert Anisko <anisko_r(a)lrde.epita.fr>
aroune = Aroune Aroumougame <aroune.aroumougame(a)gmail.com>
+aseure = Anthony Seure <anthony.seure(a)lrde.epita.fr>
astrid = Astrid Wang <astrid(a)lrde.epita.fr>
audin = Maurice Audin <audin(a)lrde.epita.fr>
auroux = Lionel Auroux <auroux_l(a)lse.epita.fr>
diff --git a/src/svn-to-git/convert-lrde-seminars-to-git
b/src/svn-to-git/convert-lrde-seminars-to-git
new file mode 100755
index 0000000..9fde65c
--- /dev/null
+++ b/src/svn-to-git/convert-lrde-seminars-to-git
@@ -0,0 +1,52 @@
+#! /bin/sh
+
+# Convert the lrde-seminars repository from Subversion to Git.
+# This repository actually contains the sources of the CSI seminar,
+# hence the renaming to csi-seminar.
+
+./svn-to-git
https://svn.lrde.epita.fr/svn/lrde-seminars \
+ csi-seminar authors-lrde.full
+
+# Postprocessing.
+cd csi-seminar
+# Remove branch 'git-svn'.
+git branch -d git-svn
+# Set back i18n.commitencoding to ISO-8859-1 before rewriting the Git
+# repo, so that commits and messages are correctly processed.
+git config i18n.commitencoding ISO-8859-1
+# Get rid of the trunk/ prefix. Also, remove empty commits. As the
+# head commit of the rewritten `master' branch is incompatible with
+# the original checked out working copy, this command may complain
+# about a failed merge and exit with an erroneous status; just ignore
+# it and reset to HEAD (i.e. `master').
+git filter-branch \
+ --prune-empty \
+ --tree-filter '
+ if test -d trunk; then cp -fa trunk/* .; fi
+ rm -rf trunk
+ ' --tag-name-filter cat -- --all || true
+git reset --hard HEAD
+rm -rf .git/refs/original
+# In addition, cancel the commit that initiated the top-level branch/
+# directory, by rewriting the history using git-rebase. For more
+# information on this, see
http://stackoverflow.com/a/4558567/1551751
+cat >flatten-branches <<EOF
+#! /bin/sh
+
+mv \$1 \$1.\$\$
+grep -v 'Moved the only existing branch to the global branches directory' \\
+ <\$1.\$\$ >\$1
+rm -f \$1.\$\$
+EOF
+chmod +x flatten-branches
+env GIT_EDITOR="$(pwd)/flatten-branches" git rebase --interactive \
+ $(git rev-list --all | tail -n 1)
+# Reset i18n.commitencoding to default (UTF-8).
+git config --unset i18n.commitencoding
+cd ..
+
+# To install on the Git server, use:
+#
+# cd csi-seminar
+# git remote add origin git@git.lrde.epita.fr:csi-seminar
+# git push --all origin
diff --git a/src/svn-to-git/svn-to-git b/src/svn-to-git/svn-to-git
index a080865..ad45a96 100755
--- a/src/svn-to-git/svn-to-git
+++ b/src/svn-to-git/svn-to-git
@@ -147,13 +147,13 @@ env git_repo="$git_repo" tmp_dir="$tmp_dir"
sed="$sed" md5sum="$md5sum" \
-e "s,^/,," \
| "$sed" -e
"s|https://svn/svn-lrde/|https://svn.lrde.epita.fr/svn/|" \
-e
"s|https://svn\\.lrde\\.epita\\.fr/svn-lrde/|https://svn.lrde.epita.fr/svn/|" \
- | while read path url; do
- echo "$path :: $url" >&2
- url_hash=`echo $url | "$md5sum" | cut -d" " -f 1`
- ext_tmp_dir="$tmp_dir/svn-externals/$url_hash"
+ | while read ext_path ext_url; do
+ echo "$ext_path :: $ext_url" >&2
+ ext_url_hash=`echo $ext_url | "$md5sum" | cut -d" " -f 1`
+ ext_tmp_dir="$tmp_dir/svn-externals/$ext_url_hash"
if test ! -d "$ext_tmp_dir"; then
- mkdir -p "$ext_tmp_dir/$(dirname $path)"
- svn export $url "$ext_tmp_dir/$path"
+ mkdir -p "$ext_tmp_dir/$(dirname $ext_path)"
+ svn export $ext_url "$ext_tmp_dir/$ext_path"
fi
(cd "$ext_tmp_dir" && tar cf - .) | tar xf -
done
--
1.7.10.4