revision control with mercurial
DESCRIPTION
TRANSCRIPT
![Page 1: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/1.jpg)
Revision Control with MercurialPaulo Gandra de Sousa
@pagsousa
![Page 2: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/2.jpg)
Agenda
• The need• Basic concepts• Distributed revision control• Best practices• Tools
![Page 3: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/3.jpg)
The need
• Share and synchronize among team members• Fast and reliable undo• For errors• For previous released versions
• Track changes• Connect with task & bug management
• Sandboxing
![Page 4: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/4.jpg)
http://betterexplained.com/articles/a-visual-guide-to-version-control/
Basic concepts
• Repository• Trunk• Add• Check in
• Revision• Diff• Head
![Page 5: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/5.jpg)
Basic edit flowhttp://betterexplained.com/articles/a-visual-guide-to-version-control/
• Check out• Working copy• Revert• Check in
![Page 6: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/6.jpg)
http://betterexplained.com/articles/a-visual-guide-to-version-control/
Handling conflits
• Diff• Merge• Resolve
![Page 7: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/7.jpg)
Handling files
• Add• Delete• Rename• Forget
• Lock• To avoid
![Page 8: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/8.jpg)
Distributed version control
• Each user owns a repository and serve it to other users
• May use central (by convention) repository
http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/
![Page 9: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/9.jpg)
Geographicaly distributed teams
http://www.ericsink.com/vcbe/vcbe_a4_lo.pdf
![Page 10: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/10.jpg)
Revisions, heads, tips
Merge changeset
head
Head; tip
![Page 11: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/11.jpg)
http://hginit.com/02.html
• Each user clones a “central” repository or inits a local repository
• Joel edits and/or adds files, check status, and commits in his local repository
![Page 12: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/12.jpg)
http://hginit.com/02.html
• Joel pushes his change set to another (e.g., the “central”) repository
• Rose pulls from the central repository
push
pull
![Page 13: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/13.jpg)
http://hginit.com/02.html
• Joel and Rose edit and commit in their local repository
• Rose pushes to the central repository
![Page 14: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/14.jpg)
http://hginit.com/02.html
• Joel trys to push but gets an error
• Joel pulls the changes
• Joel merges the two heads and resolves any conflict
• Joel commits and pushes to the central repository
pull
![Page 15: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/15.jpg)
Best practices
• Pull changes/Update before editing• Commit often• One commit – one issue• Write meaningful commit messages• Don’t commit broken code• Review the merge before commit• Setup change notifications• Read Diffs from other developers
![Page 16: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/16.jpg)
TOOLSMercurial, TortoiseHG, HGE, Netbeans
![Page 17: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/17.jpg)
Mercurial
• Download• http://mercurial.selenic.com/wiki/Download
• Tutorial• http://mercurial.selenic.com/wiki/Tutorial
• Hg definitive guide• http://hgbook.red-bean.com/
• Hosting (free and comercial)• http://mercurial.selenic.com/wiki/MercurialHosting
![Page 18: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/18.jpg)
TortoiseHg
• Download• http://tortoisehg.bitbucket.org/download/
• Quick tutorial• http://tortoisehg.bitbucket.org/manual/1.1/quick.html
• TortoiseHg Manual• http://tortoisehg.bitbucket.org/manual/2.3/
![Page 19: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/19.jpg)
Shell extension menu
• Clone• Init
![Page 20: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/20.jpg)
Shell extension menu
• Commit
• Status• Add• Revert• Remove
• Update• Synchronize
![Page 21: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/21.jpg)
Hg Workbench
![Page 23: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/23.jpg)
New project
![Page 24: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/24.jpg)
Project context menu
![Page 25: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/25.jpg)
File context menu
![Page 26: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/26.jpg)
Commit
![Page 27: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/27.jpg)
Compare
![Page 28: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/28.jpg)
History
![Page 29: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/29.jpg)
Netbeans
• Download• http://netbeans.org/downloads/
• Netbean’s Mercurial User Guide• http://netbeans.org/kb/docs/ide/mercurial.html
![Page 30: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/30.jpg)
Clone repository
![Page 31: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/31.jpg)
Context
![Page 32: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/32.jpg)
History
![Page 33: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/33.jpg)
Commit
![Page 34: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/34.jpg)
Push
![Page 35: Revision control with Mercurial](https://reader038.vdocuments.site/reader038/viewer/2022103015/54c208a24a795989198b456d/html5/thumbnails/35.jpg)
Bibliography
• A visual guide to version control, http://betterexplained.com/articles/a-visual-guide-to-version-control/
• Joel Spolsky, Hg Init, http://hginit.com/• Distributed version control illustrated,
http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/
• Eric Sink, Version Control by example. http://www.ericsink.com/vcbe/vcbe_a4_lo.pdf
• Tutorial, http://mercurial.selenic.com/wiki/Tutorial• Understanding Mercurial,
http://mercurial.selenic.com/wiki/UnderstandingMercurial• Version control 10 best practices,
http://blog.manishchhabra.com/2011/04/10-version-control-best-practices/