[Zope-dev] Git conversion with svn-all-fast-export

Marius Gedminas marius at gedmin.as
Tue Feb 12 17:05:50 UTC 2013


On Mon, Feb 04, 2013 at 09:59:37PM +0200, Marius Gedminas wrote:
> You need:
> 
> - svn-all-fast-export (from the Debian/Ubuntu package of the same name;
>   upstream homepage is http://gitorious.org/svn2git, not related to a
>   Ruby tool of the same name)
> 
> - a copy of the Subversion repository
> 
>     Good thing I have one set up, using svnsync:
> 
>       # http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.replication
>       svnadmin create /stuff/zope-mirror
>       svnadmin setuuid /stuff/zope-mirror 62d5b8a3-27da-0310-9561-8e5933582275
>       svnsync init file:///stuff/zope-mirror svn://svn.zope.org/repos/main/
>       svnsync sync file:///stuff/zope-mirror
>       # repeat last command periodically
> 
>     It needs about 3.3 gigs of disk space.
> 
> - a copy of authors.txt that maps svn usernames to real names and emails
>   (ask Tres or Jim)
> 
> - an empty repository on Github (ask Tres or Jim to create one at
>   https://github.com/zopefoundation)
> 
> 
> The conversion process goes like this:
> 
> - write a rules.txt like this one I used for zope.dottedname:
> 
>     create repository zope.dottedname
>     end repository
> 
>     # feel free to create multiple repositories in one go
> 
>     # order of matches matters in this file
>     # trailing slashes in match rules are very important
> 
>     match /(zope\.dottedname)/trunk/
>       repository \1
>       branch master
>     end match
> 
>     match /(zope\.dottedname)/branches/([^/]+)/
>       repository \1
>       branch \2
>     end match
> 
>     match /(zope\.dottedname)/tags/([^/]+)/
>       repository \1
>       branch refs/tags/\2
>     end match
> 
>     match /
>       # ignore all other projects
>     end match
> 
> - run svn-all-fast-export --identity-map=authors.txt --rules=rules.txt --stats \
>       /path/to/your/zope-svn-mirror

You can also pass --svn-branches for a slightly more accurate conversion
(branch merge commits do not go away, even when the diff is empty), if
I understand it correctly.

And if you pass --add-metadata-notes, you'll get to see svn path and
revno attached to a note on each commit.  These are shown by git log.

These notes are easy to lose (git push --all/--tags doesn't push them;
git clone doesn't fetch them).  Read more about them at
http://git-scm.com/2010/08/25/notes.html

The notes are shown on Github like this:
https://github.com/zopefoundation/zope.traversing/commit/c10f103#gitnotes

> - inspect ./zope.dottedname for sanity
> 
>     I recommend tig as a very nice console-mode interactive git history viewer.

Sometimes the conversion tool produces strands of unrelated history.
tig --all interleaves them which makes this hard to notice.  gitk --all
shows them separately.

You can connect the strands by creating a grafts file, and you can make
the connections permanent (I don't think the grafts file survives a git
push) by running git-filter-branch.

>     For an example of things to inspect, e.g., there was a deleted 3.4.1 tag
>     from http://zope3.pov.lt/trac/changeset/80495, which shouldn't have been
>     deleted, according to http://zope3.pov.lt/trac/changeset/80499, so I've
>     re-created the tag from refs/backups/r80495/tags/3.4.1 that was left by
>     the conversion tool.

And 'git shortlog -s' is a good way to check if your authors.txt was
complete and correct.


Note: if you find you need to re-run the conversion, make sure to rm -rf
the git repository _and_ the log-zope.whateverpackage file that
svn-all-fast-export uses to remember where it last crashed.

> - upload to github

This'll be

    git remote add origin git at github.com:zopefoundation/zope.dottedname.git
    git push -u origin --mirror

if you want to push everything (branches, tags, notes).


Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.zope.org/pipermail/zope-dev/attachments/20130212/7ac2b127/attachment.sig>


More information about the Zope-Dev mailing list