Evolution of version control in opensource - fossa2010

733 views

Published on

ECLIPSE – RED HAT
Chris Aniszczyk

Evolution of Version Control in Open Source

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
733
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Evolution of version control in opensource - fossa2010

  1. 1. Evolution of Version Control in Open Source Lessons learned along the path to distributed version controlChris Aniszczyk (Red Hat)Principal Software Engineerzx@redhat.comhttp://aniszczyk.org
  2. 2. About MeIve been using and hacking open source for ~12 years - contribute{d} to Gentoo Linux, Fedora Linux, EclipseEclipse Board of Directors, Committer RepresentativeMember in the Eclipse {Architecture,Planning} CouncilI like to run! (just finished Chicago marathon in 3:20)Co-author of RCP Book (www.eclipsercp.org) Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  3. 3. Agenda History of Version Control (VCS) The Rise of Distributed Version Control (DVCS) Lessons Learned at Eclipse moving to a DVCS Conclusion Q&APicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  4. 4. Version Control Version Control Systems manage change “The only constant is change” (Heraclitus) Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  5. 5. Why Version Control? VCS became essential to software development because: They allow teams to collaborate They manage change and allow for inspection They track ownership They track evolution of changes They allow for branching They allow for continuous integration Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  6. 6. Version Control: The Ancients 1972 – Source Code Control System (SCCS) Born out of Bell Labs, based on interleaved deltas No open source implementations as far as I know 1982 – Revision Control System (RCS) Released as an alternative to SCCS Operates on single files Open source implementation hosted at GNU Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  7. 7. Version Control: The Centralized One centralized server with the revision information Clients checkout a working copy locally Most operations happen on the server Linear revision history Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  8. 8. Version Control: The Centralized 1990 – Concurrent Versions System (CVS) Initially released as some scripts on top of RCS Made branching possible for most people Revisions by commits are per file :( No atomic commit :( Not really maintained anymore... 2000 – Subversion (SVN) Released as an improvement to CVS Atomic commits via transactions Open source implementation hosted at Apache Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  9. 9. “Hey, get back to work!” … “My codes merging” - remember those days you spent merging in changes in CVS/SVN?Picture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  10. 10. Version Control: The Distributed Every client has a copy of the full repository locally All repository operations are local (except sharing) Intelligent network operations when sharing content A very non linear revision history Large online communities to share changes Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  11. 11. Version Control: The Distributed 2001 – GNU arch First open source DVCS Deprecated; not maintained anymore --- In 2005, Bitkeeper was no longer open source --- 2005 – Git Created as the SCM for the Linux kernel by Linus 2005 – Mercurial (Hg) Cross-platform DVCS 2007 – Bazaar (BZR) Sponsored by Canonical Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  12. 12. Agenda History of Version Control (VCS) The Rise of Distributed Version Control (DVCS) - How does a DVCS work? - The benefits of a DVCS Lessons Learned at Eclipse moving to a DVCS Conclusion Q&APicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  13. 13. How does it work? A DVCS generally operates at the level of a changeset Logically, a repository is made up from an initial empty state, followed by many changesets Changesets are identified by a SHA-1 hash value e.g., 0878a8189e6a3ae1ded86d9e9c7cbe3f Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  14. 14. Its all about the changesets Changesets contain pointers to the previous changeset previous: 48b2179994d494485b79504e8b5a6b23ce24a026 --- a/README.txt +++ b/README.txt @@ -1 +1 @@ -SVN is great +Git is great previous: 6ff60e964245816221414736d7e5fe6972246ead --- a/README.txt +++ b/README.txt @@ -1 +1 @@ -Git is great +SVN is great Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  15. 15. BranchesThe current version of your repository is simply a pointerto the end of the treeThe default "trunk" in Git is called "master"The tip of the current branch is called "HEAD"Any branch can be referred to by its hash idCreating branches in a DVCS is fast, you simply point toa different element in the tree on disk already Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  16. 16. MergingDVCS are all about mergingMerges are just the weaving together of two (or more)local branches into oneHowever, unlike CVCS, you dont have to specifyanything about where youre merging from and to; thetrees automatically know what their split point was in thepast, and can work it out from there.Merging is much easier in a DVCS like Git Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  17. 17. Pulling and Pushing Weve not talked about the distributed nature of DVCS Changes flow between repositories by push and pull Since a DVCS tree is merely a pointer to a branch... Theres three cases to consider for comparing two trees: • Your tip is an ancestor of my tip • My tip is an ancestor of your tip • Neither of our tips are direct ancestors; however, we both share a common ancestor Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  18. 18. Cloning and Remotes (git) git clone git://egit.eclipse.org/egit.git Where you can push or pull to is configured on a per (local) repository basis git remote add github http://github.com/zx/myegit.git origin is the default remote; you can have many remotes Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  19. 19. Software Trends and Revolution Most major open source projects use some form of DVCS Git, Hg, Bazaar Linux MySQL OpenJDK Android JQuery Gnome Fedora Bugzilla and so on... But why? Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  20. 20. Benefits of Distributed Version Control Can collaborate without a central authority Disconnected operations Easy branching and merging Define your own workflow Powerful community sharing tools Easier path to contributor to committer Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  21. 21. Collaboration Developers can easily collaborate directly without needing a central authority or dealing with server administration costs Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  22. 22. Disconnected operations rule! Developers can still be productive and not worry about a central server going down... remember the days of complaining that CVS was down and you couldnt work? Also, theres a lighter server load for administrators! Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  23. 23. Branches everywhereCreating and destroying branches are simpleoperations so its easy to experimentwith new ideasVery easy to isolate changes Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  24. 24. Define your own workflow Define your own workflow to meet your team needs. Different workflows can be adopted as your team grows without changing VCS toolsets! Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  25. 25. DVCS and Building CommunityDevelopers can easily discover and fork projects. Ontop of that, its simple for developers to share theirchanges“Distributed version control is all about empoweringyour community, and the people who might join yourcommunity” - Mark Shuttleworth Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  26. 26. Agenda History of Version Control (VCS) The Rise of Distributed Version Control (DVCS) Lessons Learned at Eclipse moving to a DVCS - Version control at Eclipse - Code review at Eclipse - Challenges in moving to a DVCS Conclusion Q&APicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  27. 27. Version Control at Eclipse Eclipse defined a roadmap to move to Git in 2009 CVS is deprecated; SVN will be deprecated in the future EGit is an Eclipse Team provider for Git http://www.eclipse.org/egit/ JGit is a lightweight Java library implementing Git http://www.eclipse.org/jgit/ The goal is to build an Eclipse community around Git So why did Eclipse.org choose Git? Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  28. 28. #1: Git-related projects at Eclipse.org … both the core Git library (JGit) and tooling (EGit) are actively developed at Eclipse.org by a diverse set of committers and contributors with a common goalPicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  29. 29. History of JGit and EGit2005 Linus Torvalds starts Git2006 Shawn Pearce starts JGit2009 Eclipse decides roadmap for Git migration JGit/EGit move to eclipse.org SAP joins JGit/EGit3/2010 Released 0.7 (first release at Eclipse) Diff/Merge Algorithms, Automatic IP Logs6/2010 Released 0.8 (Helios) Usability Improvements, Git Repositories View, Tagging9/2010 Released 0.9 (Helios SR1) Merge, Synchronize View, .gitignorePlanned: 12/2010 0.10 (Helios SR2) 3/2011 0.11 6/2011 1.0 (Indigo) Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  30. 30. #2: Git is fast … Git is fast and scales wellPicture 5 *whyisgitbetterthanx.com Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  31. 31. #3: Git is mature and popular … Git is widely used and is the most popular distributed version control systemPicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  32. 32. #4: Git community tools … the Eclipse community is interested in taking advantage of such Git tools like Gerrit Code Review (used by the Android community) and GitHubPicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  33. 33. Roles at Eclipse and Code ReviewCommitter Formally elected Can commit own changes without reviewContributor Small changes reviewed by committers Bigger changes also formal IP review by legal team in separate protected Bugzilla (IPZilla)Review Tool patches attached to bug in Bugzilla comments in Bugzilla Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  34. 34. Code Review via Bugzilla Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  35. 35. Eclipse – Review ProcessContributors • create patch using CVS, SVN, Git (since 2009) • attach patch to bug in BugzillaCommitters • do code and IP review • comment, vote in Bugzilla • create CQ for changes needing IP review • commit accepted changesIP Team • does IP review bigger changes from contributors Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  36. 36. Eclipse – Review ProcessReview not done for all changesEach Eclipse.org project does it differentlyReview tedious for contributors(and also for committers mentoring contributors) Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  37. 37. Gerrit Code Review Gerrit is a Code Review system based on JGit http://code.google.com/p/gerrit/ Also serves as a git server adding access control and workflow Used by • Android https://review.source.android.com/ • JGit, EGit http://egit.eclipse.org/r/ • Google, SAP, … Eclipse wants to use it … Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  38. 38. History: Google and code review tools Mondrian (Guido van Rossum) • based on Perforce, Google infrastructure • Google proprietary Rietvield (Guido van Rossum) • based on Subversion • Open Source hosted on GoogleApp Engine Gerrit (Shawn Pearce) • started as a fork of Rietvield • based on JGit and GWT • Open Source (Android) • Apache 2 license Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  39. 39. One Branch One Feature Master  branch  contains  only  reviewed  and  approved  changes • master  moves  from  good  to  be7er  state  a)er  each   (approved)  change Each  feature  branch  is  based  on  master  branch • stable  star6ng  point A  change  can  really  be  abandoned  because • no  other  approved  change  can  depend  on  a  not  yet   approved  change • Gerrit  will  automa6cally  reject  a  successor  change  of  an   abandoned  change Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  40. 40. Gerrit – Lifecycle of a Change • create local topic topic branch master • commit change 1 • push it for review a • do review • automated verification Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  41. 41. Gerrit – Lifecycle of a Change • create local topic topic branch master • commit change • push it for review 1 • do review • automated a verification topic master c • refine based on 3 review • push new patchsets b 2 until review votes ok 1 a Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  42. 42. Gerrit – Lifecycle of a Change • create local topic master topic branch master • commit change • push it for review d topic 1 • do review a • automated verification c 3 b topic master 2 c • refine based on a 1 3 review • push new patchsets b until review votes ok 2 • Submit may lead to server-side merge 1 a • or merge / rebase before push Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  43. 43. Gerrit Workflow Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  44. 44. Gerrit Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk http://egit.eclipse.org/r/ - change,825
  45. 45. Eclipse.org: Challenges moving to a DVCS Convincing management and peers was tough - At first, everyone is resistant to change The learning curve of DVCS systems is high - Initially, the Eclipse tooling was “alpha” - People refuse to drop to the CLI Legacy is a pain in the ass! - 200+ projects at Eclipse used CVS/SVN - The existing VCS tooling was high qualityPicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  46. 46. No free lunch! … trust me, the only way to learn DVCS is to start using it... there is a learning curve, you need to rewire your brain!Picture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  47. 47. Git Resources http://git-scm.com/documentation is your friend Watch Linus talk at Google http://www.youtube.com/watch?v=4XpnKHJAok8 Read the Pro Git book - http://progit.org/book/ Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  48. 48. Agenda History of Version Control (VCS) The Rise of Distributed Version Control (DVCS) Lessons Learned at Eclipse moving to a DVCS Conclusion Q&APicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  49. 49. ConclusionThe future of version control is distributed!Moving to a DVCS takes timeGerrit enables a nice code review workflowOpen source has embraced the way of DVCS Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk
  50. 50. Q&APicture 5 Evolution of Version Control in Open Source | © 2010 by Chris Aniszczyk

×