Conversion script
This is a svn2git migration adapted for our svn layout available there.
Quick guide
See also http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/projects/git-guide/notes.mdwn?op=file&rev=0&sc=0 and the (git version of the) policy.
Checkout the scripts (after installing python-debian, git-buildpackage and pristine-tar):
svn checkout svn://svn.debian.org/svn/pkg-ocaml-maint/trunk/tools/svn2git svn checkout svn://svn.debian.org/svn/pkg-ocaml-maint/trunk/projects/git-guide
Put glondu_svn2git.py and new-d-o-m-git-repo in your path. Then go to an empty directory and execute:
glondu_svn2git.py -p <package> -t <upstream-name>
<package>: the package name. The script will checkout svn://svn.debian.org/svn/pkg-ocaml-maint/trunk/packages/<package>.
<upstream-name>: the name of the directory with upstream tarballs (usually upstream or tarballs).
Check the result (for example, with gitk), and if you are satisfied, push it to alioth (run this command from the repos directory):
new-d-o-m-git-repo <package>
Remarks
The script does many checks in the process and should fail in any situation that I (StephaneGlondu) don't expect. Many cases are not handled, but the script should be easily debugged and adapted for simple packages. Since it is self contained and uses only basic commands, it should be easily adapted to whatever processing we would like to do on the fly.
Some caveats and possible future improvements:
- The mapping from alioth logins to full names is hard-coded in the script.
- File renamings/movings might be seen as deletions/creations (with all drawbacks)... but I don't know if svn itself tracks such modifications differently. Anyway, git-import-orig should have the same behaviour (I've mimicked its algorithm).
- In tag names, "~" are not allowed... they are currently replaced with "." (which is the behaviour of git-import-orig).
Shell script generation approach
See http://lists.debian.org/debian-ocaml-maint/2008/07/msg00028.html
Many repositories below have been converted using a generated shell script. For now, the generated scripts and related files are in my (glondu-guest) home on alioth, in svn2git-migration-files directory. -- StephaneGlondu 2008-08-09 15:04:46
Quick guide:
- go to an empty directory, the last part of the path must be the package name
- add /usr/src/pkg-ocaml-maint/mr/tools/svn2git (or wherever this is checked out) to your $PATH
. /usr/src/pkg-ocaml-maint/mr/tools/svn2git/functions.sh
get_log && get_tag_log && gen_sh
- have a look at ${PKG}.sh, and fix it if needed
svn_checkout && git_init
./${PKG}.sh
cd git && git_finalize && gitk --all and check
submit_repo from the git dir
Tips:
- have a look at functions.sh
- if the package has started with the old layout, you might have to manually checkout the svn at an earlier revision with the old path (svn checkout svn://svn.debian.org/svn/pkg-ocaml-maint/packages/${PKG}@REV svn, where REV is the first revision found in ${PKG}.sh)
- you can run selected parts of the script by enclosing the inhibited parts in shell functions
- Before revision 1165, the command git-import-orig use a bad path for tarball, replace "git-import-orig --pristine-tar --no-dch ../svn/${TARBALL}" by "git-import-orig --pristine-tar --no-dch ../svn/trunk/${TARBALL}"
- Revision 1165 is the first "layout" switch revision. To handle it replace "svn update -r 1165" by "svn switch svn://svn.debian.org/svn/pkg-ocaml-maint/trunk/packages/${PKG}@1165"
- Between revision 1165 and 1655 there is the "svn-buildpackage" transition, look for "unable to guess working" string and fix it
- After revision 1165 (maybe 1655), look for a second git-import-orig of the previous ${TARBALL} and remove it. This is a duplicate of the git-import-orig before the "layout" switch
Progress
Converted repositories are available on http://git.debian.org/ (in pkg-ocaml-maint/packages subtree).