Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

migrate SVN Repo to Git with history preservation, how should we do this?

hermsen
2021-09-17
2021-10-03
  • hermsen

    hermsen - 2021-09-17

    Hi everybody!

    My question is fairly simple: we have some svn repo's hosted on Forge. Since git client has been integrated into CODESYS IDE (yay!), we wish to migrate to git and use that SCM henceforth.
    With migration I mean that the svn data including history is converted into git (with history)

    Has anybody of you ever needed to do this? If so, how did you achieve this task?
    So what software / tools did you use?

    I hope to hear from you all

     
  • eschwellinger

    eschwellinger - 2021-09-23

    Hi,

    The only way to migrate is the following:
    Check out revision from SVN and then commit that state to Git. And this for each revision you want to have in Git.

    Once the Git scripting interface is ready, you can script the migration if necessary.
    But we have no release date for this.

    Background:
    The formats of the data stored in Git and SVN are not compatible. So a direct migration from SVN to Git is not possible.

     
    πŸ‘
    1
  • hermsen

    hermsen - 2021-09-23

    It's not ideal but it is an option ;-)
    Anyway, I feel a migration script, courtesy of CODESYS, coming up in due time.
    It should do this tedious manual labour intensive task fully automated.

    Give the script a source SVN, destination git and the proper credentials and let her rip.

     

    Last edit: hermsen 2021-09-23
  • hermsen

    hermsen - 2021-09-30

    Currently one of three svn repo's is converted.

     
  • hermsen

    hermsen - 2021-10-02

    After piecewise converting some repo's by hand I can surely say that a kind of automated tool would be highly advisable. I hope codesys will provide us a burnerplate python script for this as soon as you guys have released the python scripting api. Converting by hand takes loads of manual labour.

     
    πŸ‘
    1
    • Ingo

      Ingo - 2021-10-03

      Please let us take part. Because the solution sounds fairly simple. What did you need to do manually, and is so much work?

       
  • i-campbell

    i-campbell - 2021-10-03

    so there is an "anything older than today is found in SVN" solution. This makes sense from an effort point of view, but there are advantages to converting your entire history to git. lets use lib/cobolt/ as an example.

    Now the lib/cobolt/ SVN has something like 1000 revisions. This is 6 things:

    • .library
    • example.project
    • unittest.project
    • binary .project and. library files as duplications of those three
    • some images for the project website
    • some readmes and licenses

    so what can be automated currently is:

    1. checking out every revision, and disconnecting the .project and .library from SVN.

    but then the manual steps are:

    1. Then some effort is required to identify, what was changed in each revision, and to which git repository those changes should end up in. Perhaps some could be automated, but you would have to program the assumptions.

    2. The binaries, images and readme files are relatively light work. Some of the binaries are still connected to SVN at the old /prj/mqttsparkplugb/ url, but the decision is made to preserve the binaries as they were committed.

    3. now to get the first revision of each cds project/library into git is easy, but manual. you just git initialize the disconnected project, commit all (manually copying the commit message, manually copying the commiter details) add a git remote and push.

    4. Now for the next commit, you find the next relevant commit, you do a project compare (to the project revision you checked out from SVN and disconnected earlier), accept all the changes, commit all (manually copying the commit message and conmitter details) and push.

    5. Tags to be added using git bash.

     
    πŸ‘
    1
  • hermsen

    hermsen - 2021-10-03

    I'd like to chime in that various steps
    during this process are very cpu intensive and caused CODESYS to sometimes slow down beyond workable or crash. Especially during Project compare phase.

     

    Last edit: hermsen 2021-10-03

Log in to post a comment.