[OSGeo-Discuss] Experiences moving from SVN to GIT by keeping existing TRAC ?

thomas bonfort thomas.bonfort at gmail.com
Mon Oct 12 04:06:09 PDT 2015


Sandro,
Both mapserver and proj.4 were migrated from trac/svn to git(hub). The
plain git (not github) part can be done by "git svn" and the following
script that creates a lookuptable that matches svn revisions with git
shas. From that lookuptable you can update your trac db to replace
r1234 instances by their git sha.

--
thomas


#!/bin/sh

# This script creates a 'lookup table', matching SVN revision IDs with
GIT revision IDs
# Run it inside a GIT repository that is imported from SVN with "git svn".
#
# Usage:
# createLookupTable > lookupTable.txt

# Creates a lookup table between SVN IDs and Git IDs
git rev-list --all --pretty=medium > revlist.txt;

# Now extract the git hash and the svn ID. Then we join lines
pair-wise and we have our table
cat revlist.txt | grep git-svn-id | sed -e 's/git-svn-id: [a-z0-9
\#A-Z_\/:\.-]\{1,\}@\([0-9]\{1,5\}\) .\{1,\}/\1/' > svn.txt;
cat revlist.txt | grep ^commit > git.txt;

# Join them and write the lookup table to standard output
paste svn.txt git.txt | sed -e 's/commit //' | sed -e 's/ //g' | sort -n

# Clean up
rm svn.txt git.txt revlist.txt

On 12 October 2015 at 12:38, Sandro Santilli <strk at keybit.net> wrote:
> I'm evaluating the cost of moving PostGIS code from SVN to GIT and
> wondering how other projets (if any) dealt with this.
>
> I think it would involve:
>
>  1) import SVN repo into a GIT one.
>  2) rewrite TRAC ticket references to point to corresponding GIT
>     hashes.
>
> Did anyone do any of the above targetting OSGeo infrastructure ?
>
> Background:
>  [ git/trac sandbox ] ( https://trac.osgeo.org/osgeo/ticket/720 )
>  [ Is PostGIS ready for git ? ]
>  ( https://lists.osgeo.org/pipermail/postgis-devel/2015-October/025291.html)
>
> --strk;
> _______________________________________________
> Discuss mailing list
> Discuss at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/discuss



More information about the Discuss mailing list