Your SlideShare is downloading. ×
0
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
Mercurial
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

1,344

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,344
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
11
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 Fabrizio Giudici 1
    • 2. What’s Mercurial? • Distributed SCM • Different than centralized model (cvs, svn) • Multiple full repos can be cloned • Push/pull allow to synchronize them 2
    • 3. Cloning a repo fritz% hg clone https://kenai.com/hg/jrawio~src destination directory: jrawio~src updating working directory 361 files updated, 0 files merged, 0 files removed, 0 files unresolved 3
    • 4. Changeset ids • Each committed change gets an unique id • A long SHA-1 hash, a short local number fritz% hg log changeset: 945:f7da9a8b458e user: fabriziogiudici date: Fri Jan 08 12:34:44 2010 +0100 summary: Fixed a problem that prevented builds with Windows. changeset: 944:57a85a01c6ea user: fabriziogiudici date: Thu Dec 03 20:40:33 2009 +0100 summary: Configured snapshot repository. 4
    • 5. Tags fritz% hg tags tip 694:f937409f32e9 1.5.4 692:6e1d38eff017 1.5.3 638:707fa855b850 1.5.2 568:bda51f8fea52 1.5.1 373:c4b375a8ef3c 5
    • 6. Update the work area fritz% hg update -C 612 70 files updated, 0 files merged, 0 files removed ... fritz% hg id 22cdc4017acf+ (1.6) fritz% hg update -C 1.5.2 93 files updated, 0 files merged, 7 files removed ... fritz% hg id bda51f8fea52+ 1.5.2 fritz% hg update -c default 120 files updated, 0 files merged, 0 files removed ... fritz% hg id 13cc733c3fd6 fritz% hg update -c tip 27 files updated, 0 files merged, 9 files removed ... fritz% hg id 3f1e2f3aea37 (1.6) tip 6
    • 7. Commit fritz% hg commit -m "Commit message." fritz% hg rollback rolling back last transaction fritz% hg outgoing comparing with https://kenai.com/hg/jrawio~src searching for changes changeset: 689:166e784caab1 parent: 687:70982f05332b user: fabriziogiudici date: Tue Aug 25 13:21:58 2009 +0200 summary: Changed version number. changeset: 690:51f2a49661cf tag: tip user: fabriziogiudici date: Tue Aug 25 13:22:13 2009 +0200 summary: Updated the license. 7
    • 8. Commit is local fritz% hg rollback rolling back last transaction fritz% hg strip -f 687 81 files updated, 0 files merged, 0 files removed, 0 files unresolved saving bundle to /private/tmp/src/.hg/strip-backup/ 8823e28e8eb5-backup 8
    • 9. Push fritz% hg push pushing to https://kenai.com/hg/jrawio~src searching for changes adding changesets adding manifests adding file changes added 7 changesets with 72 changes to 78 files (+1 heads) 9
    • 10. Remote changes fritz% hg incoming comparing with https://kenai.com/hg/jrawio~src searching for changes changeset: 692:6e1d38eff017 tag: 1.5.4 user: hudson date: Sun Aug 23 21:12:15 2009 +0200 summary: [maven-release-plugin] prepare release 1.5.4 changeset: 693:6a22b7d32402 user: hudson date: Sun Aug 23 21:12:35 2009 +0200 summary: [maven-release-plugin] copy for tag 1.5.4 10
    • 11. Pull fritz% hg pull pulling from https://kenai.com/hg/jrawio~src searching for changes adding changesets adding manifests adding file changes added 8 changesets with 18 changes to 4 files (run 'hg update' to get a working copy) 11
    • 12. What about branches? • Local repo clones are branches • Named branches too fritz% hg branches default 694:f937409f32e9 fix-jrw-246-1 637:cbf229d7afce 1.6 621:f9584b14a8e4 2.0 587:d4139f45eafa fix-JRW-120 562:a82b7ed21b94 fix-JRW-6 560:eb9031bec74c fix-JRW-162-and-JRW-194 367:e75735d2055c 12
    • 13. Creating a branch fritz% hg branch default fritz% hg branch my-new-branch marked working directory as branch my-new-branch fritz% hg commit -m "Created my-new-branch." 13
    • 14. Merging, closing fritz% hg update -c default 77 files updated, 0 files merged, 0 files removed, ... fritz% hg merge -f -r fix-JRW-234 3 files updated, 0 files merged, 0 files removed, ... (branch merge, don't forget to commit) fritz% hg commit -m "Merged changes from branch fix- JRW-234" fritz% hg update -c fix-JRW-234 127 files updated, 0 files merged, 6 files removed, ... fritz% hg commit --close-branch -m "Closed branch fix- JRW-234" created new head fritz% hg update -c default 120 files updated, 0 files merged, 0 files removed, ... 14
    • 15. Patches • diff can be rich (à la Git) • export include extra info (e.g. committers) fritz% hg diff -g -r default > mypatch.diff fritz% hg export -g fix-JRW-234 -o mypatch.diff 15
    • 16. Notes • No svn-admin pain • Ok for start up spikes • Branch-per-commit? • Best practices: CI? • More entropy 16
    • 17. References • fabrizio.giudici@tidalwave.it • http://java.net/blog/fabriziogiudici • http://jrawio.tidalwave.it/development/ mercurial+best+practices/ 17

    ×