Top Banner
Introduction to Git-SVN Patrick Burma, Solutions Architect, WANdisco
21

Introduction to Git-SVN - WANdisco

May 05, 2023

Download

Documents

Khang Minh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to Git-SVN - WANdisco

Introduction to Git-SVN

Patrick Burma, Solutions Architect, WANdisco

Page 2: Introduction to Git-SVN - WANdisco

Agenda

•  Migration of SVN and Git •  Tools and Techniques •  Git-SVN •  Sub-Git •  Use Cases •  References

Page 3: Introduction to Git-SVN - WANdisco

Integrating Subversion and Git

Page 4: Introduction to Git-SVN - WANdisco

Migration of SVN and Git

•  Lot’s of existing production Subversion repositories, Git is newer and not as mature but growing rapidly –  Need a way to mitigate risk, and keep “golden

processes” in place while Git infrastructure matures –  Others?

•  Types of migration –  One time convert from one system to another –  Continuously push data from one system to another –  Sync data back and forth between the two

Overview

Page 5: Introduction to Git-SVN - WANdisco

Migration of SVN and Git

•  Some good ways to push data from one system to another

•  No great ways to bidirectional sync •  Why?

–  System architectures too different

•  What’s the answer –  Let’s look at our options and then decide….

•  Maybe its best to keep one, the other or both as separate systems

Challenges

Page 6: Introduction to Git-SVN - WANdisco

Migration of SVN and Git

•  Subversion system –  Revs are based on Changesets –  Merges are tracked using metadata (svn:mergeinfo) –  Data stored in the FSFS

•  Git –  Based on SHA’s –  Different merge algorithms (eg; up-to-date, fast-forward) –  Data stored in .git repository format

•  Terminologies and actions differ –  Actions in one that don’t exist in the other

•  Consider clone, push, pull, propset •  Some actions do overlap, here is where integration

occurs –  Commit, rename, move, branch

High Level Overview

Page 7: Introduction to Git-SVN - WANdisco

Migration of SVN and Git

•  Best –  One time import, for example importing a Subversion

repository into Git •  Ok

–  Single direction, for example pushing Git changes into Subversion

•  Worst –  Continuous bi-directional integration between

Subversion and Git

Use Cases

Page 8: Introduction to Git-SVN - WANdisco

Migration of SVN and Git

•  Git and Subversion don’t directly translate –  There is no equivalent git rebase command in Subversion

•  Differences in system architectures and data storage without a common language to interface between them (eg; SQL)

•  Troubles if you want to do bi-directional integration because: –  Branching and merging won’t translate, without merge tracking

you’ll be stuck doing 2-way diffs –  At the very least you have to minimize some capabilities of either

tools and go to a simple and very linear mainline development approach.

–  Other issues, such as externals, which there are no solutions for?

–  Any Gothcha’s? •  For imports historical accuracy. Especially around moves/renames/

deletes.

Summary

Page 9: Introduction to Git-SVN - WANdisco

Tools and Techniques

•  Git-SVN – Comes with Git •  Sub-Git – Free to download and try, has a cost

to use in production •  Custom scripts and services •  Others

–  Clearvision –  Tailor (dead project) –  SSCM (also dead) –  More?

Tools

Page 10: Introduction to Git-SVN - WANdisco

Tools and Techniques

•  Consider a few Git best practices. –  Tendency is to have many more Git repositories then

Subversion •  Scope out mapping options

–  Repo-to-repo, this would mean one Git repository to one Subversion repository

–  Project based? Many Git repositories map to a single Subversion repository as projects

–  Branches, Tags and Trunks. •  Common layouts or unique layouts?

Techniques

Page 11: Introduction to Git-SVN - WANdisco

Tools and Techniques

•  Automate with post-commit hooks •  Develop new repo generation scripts

–  Sets config options and points to proper places

•  Author mapping •  Understanding Limitations

–  Git Rebase –  Fast-Forward Merges –  Squashed History –  Weird Stuff

Techniques

Page 12: Introduction to Git-SVN - WANdisco

Git-SVN

•  Comes with Git •  Perl script •  Several iterations and improvements

About

Page 13: Introduction to Git-SVN - WANdisco

Git-SVN

•  Main git svn commands –  Clone –  Fetch –  Log

Commands

Page 14: Introduction to Git-SVN - WANdisco

Git-SVN

•  Create repositories from test Subversion repository for Git and workspace for SVN

git svn clone https://pat-wandisco.googlecode.com/svn/trunk/ pat-wandisco.git --username [email protected] svn checkout https://pat-wandisco.googlecode.com/svn/trunk/ pat-wandisco --username [email protected] --password hH3YV5jc6CP4 •  Modify and commit files from Git cd pat-wandisco.git/trunk echo test git commit >> file1.txt git commit –m “Adding my first change to git, my name is” git svn dcommit

Examples

Page 15: Introduction to Git-SVN - WANdisco

Git-SVN

•  Modify files in Subversion cd ../../pat-wandisco/trunk svn up svn log echo test svn commit >> file1.txt svn ci –m “Adding my commit from Subversion” •  Add another change from Git cd ../../pat-wandisco.git/trunk git svn fetch git rebase echo second change from git >> file1.txt” it svn dcommit

Examples

Page 16: Introduction to Git-SVN - WANdisco

Sub-Git

•  Builds a Git repo from an SVN repo •  Remote Installation – If the repositories are not on

the same system •  Local Installation – They are on the same box •  Config file stores items such as mappings for

projects, directories/branches, and authors –  Allows for easy re-use/re-run of the syncs

•  Includes ignores, symlinks, merge tracking, renames, eol settings

•  Fairly simple to use •  Not free beyond trial use

Overview

Page 17: Introduction to Git-SVN - WANdisco

Sub-Git Overview

Page 18: Introduction to Git-SVN - WANdisco

Sub-Git Examples

•  Setup service accounts –  Git/Apache/SVN, run them

as same user (easiest) •  Run subgit configure

–  subgit configure reponame •  Modify configuration file •  reponame/conf/Subgit.conf •  Run subgit install

–  subgit install reponame •  Modify .git/config settings •  Write and implement hooks

Page 19: Introduction to Git-SVN - WANdisco

Use Cases

•  Git is new and growing, but all our infrastructure is built around Subversion

•  Don’t want to maintain two distinct ALM stacks •  Can’t enforce security on Git, but can on

Subversion •  No Git infrastructure to speak of (some devs are

just using it) •  Need to collaborate between two or more BU’s,

vendors, customers using either Git or Subversion

From the Audience

Page 20: Introduction to Git-SVN - WANdisco

References

•  http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git •  http://www.drdobbs.com/architecture-and-design/migrating-from-subversion-to-git-and-the/240009175 •  http://code.google.com/p/support/wiki/ConvertingSvnToGit •  http://thomasrast.ch/git/git-svn-conversion.html •  http://subgit.com •  http://jaibeermalik.wordpress.com/2013/10/23/svn2git-migrating-repository-from-subversion-to-git/ •  http://git-scm.com/book/ch8-1.html •  http://maymay.net/blog/2009/02/24/how-to-use-git-svn-as-the-only-subversion-client-youll-need/ •  https://git.wiki.kernel.org/index.php/Git-svn

External Links

Page 21: Introduction to Git-SVN - WANdisco

Thank You Pat Burma