Comparing Subversion, Git, and Mercurial - SubConf 2009

Resources / ALM

100 views
0 Likes
0 0
This presentations outlines the innate strengths and shortcomings of each of the Subversion, Git and Mercurial by practical examples of every-day operations.

Share on Social Networks

Share Link

Use permanent link to share in social media

Share with a friend

Please login to send this presentation by email!

Embed in your website

Select page to start with

2. 2 Is there SCM tool convergence?

15. 15 Mercurial: Revlog data structure

16. 16 Mercurial: Filelog

25. 25 Git: Tree objects form a hierarchy

31. 31 Subversion records the source of a copy

5. 5 Centralised design

6. 6 Distributed design

7. 7 Distributed design with a central server

11. 11 Subversion 3D tree

13. 13 Subversion 3D tree

17. 17 Mercurial: Filelog

21. 21 Git: Blob object stores file content

22. 22 Git: Every revision of a file creates a new blob

23. 23 Git: All file blobs are stored together

24. 24 Git: Tree objects represent directories

26. 26 Git: Commit object refers to a tree root

32. 32 Subversion records the source of a copy

12. 12 Subversion 3D tree

18. 18 Mercurial: Changeset calculation

19. 19 Mercurial: Manifest & changelog

1. 1 Comparing Apples to Oranges – Subversion, Git, and M ercurial - - © elego Software Solutions GmbH Comparing Apples to Oranges Subversion, Git, and Mercurial SubConf 2009 Stefan Sperling <stsp@elego.de> Stephen Butler <sbutler@elego.de>

39. 39 Comparing Apples to Oranges – Subversion, Git, and M ercurial - - © elego Software Solutions GmbH Thank you! Questions?

4. 4 Real-life situations 1. Reserving a file for editing – Centralised vs distributed

36. 36 Cherry-picking a revision  Pick a revision from a branch's history and merge i t to the HEAD of another branch. L. Wingard 2005 - Flow of Change

10. 10 Merging a text edit to a renamed file  Subversion: $ svn merge ^/A --- Merging r3 through r5 into '.': C foo.c Summary of conflicts: Tree conflicts: 1 $ svn status M . ! C foo.c > local missing, incoming edit upon merge $ svn merge ^/A/foo.c@2 ^/A/foo.c@5 bar.c --- Merging r3 through r5 into 'bar.c': U bar.c $ cat bar.c #include <stdio.h> int main() { printf("Goodbye world!\n"); } $ svn resolved foo.c

20. 20 Merging a text edit to a renamed file  Git: $ git pull ../A master remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From ../A * branch master -> FETCH_HEAD Merge made by recursive. bar.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) $ cat bar.c #include <stdio.h> void main() { printf("Goodbye world!\n"); } $

30. 30 Merging a file move  Subversion: $ svn merge ^/A --- Merging r3 through r5 into '.': A fruit/citrus/Orange.java $ svn status M . A + fruit/citrus/Orange.java $ ls fruit/ fruit/citrus/ fruit/pome/ Color.java Taste.java citrus/ pome/ fruit/citrus: Orange.java fruit/pome: Apple.java

33. 33 Merging a file move  Mercurial: $ hg pull ../A pulling from ../A searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 he ads) (run 'hg heads' to see heads, 'hg merge' to merge) $ hg merge 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ ls -R fruit/ Color.java Taste.java pome/ fruit/pome: Apple.java Orange.java

14. 14 Comparing Apples to Oranges – Subversion, Git, and M ercurial - - © elego Software Solutions GmbH Merging a text edit to a renamed file  Mercurial: $ hg pull ../A pulling from ../A searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 he ads) (run 'hg heads' to see heads, 'hg merge' to merge) $ hg merge merging bar.c and foo.c to bar.c 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat bar.c #include <stdio.h> void main() { printf("Goodbye world!\n"); } $

34. 34 Comparing Apples to Oranges – Subversion, Git, and M ercurial - - © elego Software Solutions GmbH Merging a file move  Git: $ git pull ../A master remote: Counting objects: 8, done. remote: Compressing objects: 100% (4/4), done. remote: Total 5 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (5/5), done. From ../A * branch master -> FETCH_HEAD Merge made by recursive. fruit/citrus/Orange.java | 20 +++++++++++++++++++ + 1 files changed, 20 insertions(+), 0 deletions(-) create mode 100644 fruit/citrus/Orange.java $ ls -R fruit/ Color.java Taste.java citrus/ pome/ fruit/citrus: Orange.java fruit/pome: Apple.java $

8. 8 Real-life situations 1. Reserving a file for editing – Centralised vs distributed 2. Merging a text edit to a renamed file – How is tree history modeled?

38. 38 Why should I care about the design of my SCM tool?  Design defines constraints  Your development process must adapt to constraints  Fixing bugs is easy, fixing design is hard

27. 27 Real-life situations 1. Reserving a file for editing – Centralised vs distributed 2. Merging a text edit to a renamed file – How is tree history modeled? 3. Merging a file move – Distinguishing a file move from a directory rename

28. 28 Merging a file move  Developers! Developers! Developers!  They like to refactor their code – Renaming files – Renaming directories nach Software Configuration Management Patterns Ber czuk/Appelton

3. 3 Real-life situations 1. Reserving a file for editing – Centralized vs distributed 2. Merging a text edit to a renamed file – How is tree history modeled? 3. Merging a file move – Distinguishing file move from directory rename 4. Cherry-picking a revision – Fine-grained merge tracking

35. 35 Real-life situations 1. Reserving a file for editing – Centralised vs distributed 2. Merging a text edit to a renamed file – How is tree history modeled? 3. Merging a file move – Distinguishing file move from directory rename 4. Cherry-picking a revision – Fine-grained merge tracking

9. 9 Merging a text edit to a renamed file  Edit the text of file foo.c in branch A: --- foo.c +++ foo.c @@ -1,4 +1,4 @@ #include <stdio.h> void main() { - printf("Hello world!\n"); + printf("Goodbye world!\n"); }  Rename file foo.c to bar.c in branch B  Merge the text change from branch A to branch B

29. 29 Merging a file move  A project starts out as: fruit/Color.java fruit/Taste.java fruit/citrus/Apple.java  On branch A, add a file to the "citrus" package: fruit/Color.java fruit/Taste.java fruit/citrus/Apple.java fruit/citrus/Orange.java  On branch B, move Apple.java to the "pome" package: fruit/Color.java fruit/Taste.java fruit/citrus/ fruit/pome/Apple.java  Merge the change from branch A to branch B

37. 37 Cherry-picking a revision  Release branches need to receive bug fixes  Two approaches: – Make fix in main line, then merge into release bran ch – Make fix in release branch, then merge into main li ne  Ideally, the merge should be tracked  Which approach works best for – Subversion? – Mercurial? – Git?

Views

  • 100 Total Views
  • 73 Website Views
  • 27 Embedded Views

Actions

  • 0 Social Shares
  • 0 Likes
  • 0 Dislikes
  • 0 Comments

Share count

  • 0 Facebook
  • 0 Twitter
  • 0 LinkedIn
  • 0 Google+