Advertisement
Guest User

Untitled

a guest
Nov 25th, 2011
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. Mercurial v0.1 - a minimal scalable distributed SCM
  2.  
  3. http://selenic.com/mercurial/
  4.  
  5. April 19, 2005
  6.  
  7. I've spent the past couple weeks working on a completely new
  8. proof-of-concept SCM. The goals:
  9.  
  10. - to initially be as simple (and thereby hackable) as possible
  11. - to be as scalable as possible
  12. - to be memory, disk, and bandwidth efficient
  13. - to be able to do "clone/branch and pull/sync" style development
  14.  
  15. It's still very early on, but I think I'm doing surprisingly well. Now
  16. that I've got something that actually does some interesting things if
  17. you poke at it right, I figure it's time to throw it ought there.
  18. Here's what I've got so far:
  19.  
  20. - O(1) file revision storage and retrieval with efficient delta compression
  21. - efficient append-only layout for rsync and http range protocols
  22. - bare bones commit, checkout, stat, history
  23. - working "clone/branch" and "pull/sync" functionality
  24. - functional enough to be self-hosting[1]
  25. - all in less than 600 lines of Python
  26.  
  27. When I say "pull/sync" works, that means I can do:
  28.  
  29. hg merge other-repo
  30.  
  31. and it will pull all "changesets/deltas" that are in other-dir that I
  32. don't have, merge them into the changeset history graph, and do the
  33. same for all files changed for those deltas. It will call out to
  34. a user-specified merge tool like tkdiff for a proper 3-way merge with
  35. the nearest common ancestor in the case of conflicts.
  36.  
  37. Right now, "cloning/branching" is simply a matter of "cp -al" or
  38. "rsync" (mercurial knows how to break hardlinks if needed).
  39.  
  40. Some benchmarks from my laptop:
  41.  
  42. - prepare for commit of Linux 2.6.10: ~1s
  43. - commit Linux 2.6.10: 27s
  44. - checkout Linux 2.6.10: 45s
  45. - full tree stat for added/changed/deleted files: <1s
  46. - local hardlink clone: 1.5s
  47. - empty merge between full trees: <.1s
  48. - trivial 3-way merge with changes to Makefile: ~1s
  49.  
  50. Much thought has gone into what the best asymptotic performance can be
  51. for the various things an SCM has to do and the core algorithms and
  52. data structures here should scale relatively painlessly to arbitrary
  53. numbers of changesets, files, and file revisions.
  54.  
  55. What remains to be done:
  56.  
  57. - a halfway-usable command line tool
  58. - remote (network) repository support
  59. - diff generation
  60. - changelog entry editing
  61. - various manual interventions for merge
  62. - handle rename
  63. - handle rollback
  64. - all sorts of other error handling
  65. - all sorts of cleanup, packaging, documentation, testing...
  66.  
  67. Sample usage:
  68.  
  69. export HGMERGE=tkmerge # set a 3-way merge tool
  70. mkdir foo
  71. hg create # create a repository in .hg/
  72. echo foo > Makefile
  73. hg add Makefile # add a file to the current changeset
  74. hg commit # commit files currently marked for add or delete
  75. hg history # show all changesets
  76. hg index Makefile # show change
  77. touch Makefile
  78. hg stat # find changed files
  79. cd ..; cp -al foo branch # make a branch
  80. hg merge ../branch-foo # sync changesets from a branch
  81.  
  82. [1] though the repository format is still in flux
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement