项目作者: shivpsingh

项目描述 :
Converts svn dir to git dir with history
高级语言: Python
项目地址: git://github.com/shivpsingh/svn-to-git.git
创建时间: 2019-02-11T16:18:24Z
项目社区:https://github.com/shivpsingh/svn-to-git

开源协议:

下载


svn-to-git

Description

SVN2GIT Migration Script is a python script that checks the logs of SVN Repository, Parse it and Create a JSON Dictionary from it.
Every Key:Value Pair consist of following details

  1. "Files_Commit": [
  2. [
  3. "A", # A - Added | M - Modified
  4. "branches/0002/file.sh" # files those are modified or created
  5. ],
  6. [
  7. "M", # A - Added | M - Modified
  8. "branches/0002/file2.sh" # files those are modified or created
  9. ]
  10. ],
  11. "Revision": "r8 | USERNAME | 2018-12-27 18:54:59 +0530 (Thu, 27 Dec 2018) | 1 line", # Revision Information
  12. "Comment": "[0002] Adding files.sh and file2.sh to the SVN repository", # Comment for Each Commit Made
  13. "Path": "branches", # Check if Branch / Trunk / Tag
  14. "Branch_Name": "0002" # Branch Name

Above details are used for creating individual commits at a time into a new GIT repository
[ README.md is added with GIT Initialization ]

SNV Checkout is taken in a temporary dir and a GIT Repository is initailized in a parallel repository.
SVN Files are copied one by one to GIT Repository and Added with the commit that has done in SVN Repository.

Once individual commit is done, directory is PUSHED to GIT Origin if GIT_URL is provided else the repo is created locally.

Requirements

[Windows]

  1. git.exe
  2. svn.exe

Git-Bash

https://git-scm.com/downloads

Tortoise SVN

https://tortoisesvn.net/downloads.html

Add both the tools in the path

[Linux]

  1. git
  2. svn

sudo apt-get install git
sudo apt-get install svn

Usage

  1. python3 svn2git_main.py --config=config.json
  2. [Parameters]
  3. --config = JSON File with configuration
  4. Must Have Following Key Pairs:
  5. {
  6. "NAME": "",
  7. "EMAIL": "",
  8. "SVN_URL": "",
  9. "SVN_USERNAME": "",
  10. "SVN_PASSWORD": "",
  11. "GIT_URL": "",
  12. "GIT_USERNAME": "",
  13. "GIT_PASSWORD": ""
  14. }
  15. NAME : Username for GIT Configuration
  16. EMAIL : Email ID for GIT Configuration
  17. SVN_URL : SVN Url Which is to be converted to a GIT repository
  18. SVN_USERNAME : If SVN requires Username and Password
  19. SVN_PASSWORD : If SVN requires Username and Password
  20. GIT_URL : GIT Url to be set as Origin
  21. GIT_USERNAME : If GIT requires Username and Password
  22. GIT_PASSWORD : If GIT requires Username and Password

Shiv Pratap Singh

https://www.linkedin.com/in/shiv-pratap-singh/