Your SlideShare is downloading. ×
Mercurial for Kittens
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Mercurial for Kittens

793
views

Published on

Introduction to Mercurial.

Introduction to Mercurial.

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
793
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Mercurial for Kittens
    Shuhei Takahashi<takahashi.shuhei@gmail.com>
  • 2. Mercurial
  • 3. Features
    Simple design
    Decentralized system
    High performance
    Extensible framework
  • 4. Outline
    History model
    Basic operations
  • 5. History model
  • 6. Checking out Mercurial repo
    $ hg clone http://example.com/hg example
    updating to branch default
    3 files updated, 0 files merged, 0 files removed,
    0 files unresolved
    $ ls -lA example/
    drwxr-xr-x 3 nya nya 4096 2011-05-22 20:59 .hg
    -rw-r--r-- 1 nya nya 14 2011-05-22 20:59 README
    drwxr-xr-x 2 nya nya 4096 2011-05-22 20:59 src
  • 7. Standard Mercurial repo
    example/
    .hg/
    README
    src/
    a.cc
    a.h
    Repository
    Working copy
  • 8. Standard Mercurial repo
    example/
    .hg/
    hgrc
    dirstate
    store/
    ...
    repo-local config
    working copy state
    history
  • 9. History
    .hg/
    Merge X
    Improve X
    diff -r 000000... -r 39fca2... README
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/README Sun May 22 20:59:40 2011 +0900
    @@ -0,0 +1,1 @@
    +Hello, world!
    Implemented X
    Implementing X
    Bugfix
    First commit
  • 10. Commit
    nodeid: 9e66e5ae2b...
    rev: 42
    branch: featureX
    author: "Shuhei Takahashi <nya@example.com>"
    timestamp: 2011-06-02 11:59:28 +0900
    implement feature X.
    (patch...)
    p1: 48334cb9e1... p2: 0000000000...
  • 11. nodeid
    .hg/
    bcd055...
    8a9310...
    SHA-1 hash
    Made from whole commit information
    384fca...
    a87493...
    048293...
    4fcf85...
  • 12. parents (p1,p2)
    .hg/
    p2
    p1
    p1
    • 1 or 2 parents
    • 13. null = 000000...
    p1
    p1
    p1
  • 14. rev
    .hg/
    4
    5
    • topological order
    • 15. no consistency between repos
    • 16. just for convenience!
    2
    1
    3
    0
  • 17. branch
    .hg/
    default
    featureX
    • default is "default"
    • 18. all commitshave their branch name(c.f. git)
    featureX
    featureX
    default
    default
  • 19. Notes for Git users
    Different concept of branches
    All commits have their branch name
    No reachability check
    hg log shows all commits
    Commits cannot be amended or erased (usually)
  • 20. Commit
    nodeid: 9e66e5ae2b...
    rev: 42
    branch: default
    author: "Shuhei Takahashi <nya@example.com>"
    timestamp: 2011-06-02 11:59:28 +0900
    implement feature X.
    (patch...)
    p1: 48334cb9e1... p2: 0000000000...
  • 21. Referring commits
    rev
    nodeid
    branch name... commit in the branch with the largest rev
    "tip" ... commit in any branch with the largest rev
    "null" ... root commit
    tag
  • 22. Referring commits
    .hg/
    4
    5
    3
    tip
    default
    featureX
    2
    featureX
    1
    3
    default
    0
  • 23. Basic operations
  • 24. Check out a revision
    .hg/
    4
    5
    Working Copy
    2
    1
    3
    $ hg update 3
    0
  • 25. Making commit
    Working Copy
    .hg/
    $ hg add hoge.txt
    ... edit working copy ...
  • 26. Making commit
    Working Copy
    .hg/
    $ hg commit
  • 27. Making branch
    Working Copy
    .hg/
    default
    featureX
    default
    $ hg update default
    featureX
    featureX
    default
    default
  • 28. Making branch
    Working Copy
    .hg/
    release
    featureX
    default
    $ hg branch release
    featureX
    featureX
    default
    default
  • 29. Making branch
    Working Copy
    .hg/
    release
    $ hg commit
    featureX
    default
    featureX
    featureX
    default
    default
  • 30. Pull
    hg pull
    local
    remote
  • 31. Push
    hg push
    local
    remote
  • 32. Pull / Push
    Just makes union of two history graphs
    Merge operation is never performed(c.f. Git)
    Can specify subgraph by a list of heads
  • 33. Merge - "healthy" branch
    One head per branches
    featureX
    default
  • 34. Merge - "unhealthy" branch
    "default" branch has two heads - multiple heads
    Branch tip varies by rev order!
    Push that will end up with multiple heads is rejected
    ?
    ?
    default
  • 35. Merge
    Checked out rev. 1
    Pulled rev. 2, 3, resulting multiple heads (1, 3)
    3
    1
    2
    default
    0
  • 36. Merge
    hg merge 3
    Working copy now has two parents (1, 3)
    Not yet committed!
    hg merge is forbidden if WC has pending changes
    p2
    p1
    3
    1
    2
    default
    0
  • 37. Merge
    hg commit
    4
    p2
    p1
    3
    1
    2
    default
    0
  • 38. More fun stuff
    hgweb.cgi
    Extensions
    Mercurial queue (MQ)
    Rebase
    ...
    Hooks
    Mercurial as a Python module
  • 39. References
    Mercurial: The Definitive Guide
    Chapter 4. Behind the scenes
    google:///hgbook or available from O'reilly

×