with mercurial and progress. introduction what is version control ? why use version control ? ...
TRANSCRIPT
Introduction What is version control ? Why use version control ? Centralised vs. Distributed Why Mercurial ? Using Mercurial [with Progress]
Examples / Demos Questions
Overview
Julian Lyndon-Smith, dot.r limited Progress developer since v3 Fan of vcs since 1987 Developed, sold Boss (Progress-based vcs) Other vcs systems used include
Roundtable ~1992-1994 SourceSafe ~1994-1998 Cvs ~1998-2004 Subversion ~2004-2011
Introduction
As developers, we write code that changes
over time Bugs
aka “feature” aka “undocumented behaviour” aka “works on my machine”
New functionality Aka “we could charge for this”
Better way of doing something aka “I want to play with this cool new tech”
What is version control?
Everyone uses a version control system
Just not the right one Copy foo.p foo.[x].p (where x=1 to … ) Modify foo.p
What is version control?
Audit trail of changes
Who did what, where, why and when ? Syncronization
Share the same code between developers Backup
Get any version of the file from any time Revert
Throw away local changes
Why use version control?
Centralised vcs
Centralized version control systems Cvs Source safe Rcs Subversion
Single central copy of project / source (aka “repo”)
Committing records changes into central repo Other developers see this change
Centralised vcs
Workflow Pull changes from central repo Make changes Commit changes back to central repo
Disadvantages Only “latest” copy of source available Need to be online / connected All changes to a file have to be in one
changeset
Strengths
Workflow is familiar to most developers Only one place for all source Trunk has latest version
Weaknesses
Poor merging No offline commits Any commit is available to all users
Working or not Breaks build servers Days or weeks between checkins
Commits only apply to selected subdirectory and children (subversion)
Distributed vcs
checkout checkin
checkout checkin
checkin checko
ut
checkin checko
ut
QA Repo Build Repo
Distributed vcs
Distributed version control systems Mercurial Git Arcs Bazaar
Multiple copies of all versions of project / source
Committing records changes into local repo Other developers do not see this change Until pushed back to remote repo
Distributed vcs
Workflow Clone repo Make changes Commit changes back to own repo Push changes up to remote repo
Disadvantages None …
Strengths
All repositories are equal Offline history Offline commit Less chance of merge conflicts “hidden” experimental branches
Why mercurial ?
Boiled down to git or mercurial Git
Poor documentation Complicated command lines Gui for eclipse did not work for me
Mercurial Worked first time Gui worked first time
Purely personal choice.
Using mercurial
Download from http://http://mercurial.selenic.com/
Update settings
Using mercurial
Download from http://http://mercurial.selenic.com/
Go to your source code directory hg init
There’s now a .hg directory Now “add” the source files to the repository
hg add Now commit the files to the repository
hg commit
Using mercurial
So, what happened in the repository ? hg log
Shows the history of changes User, notes, changeset id and date In reverse order (latest first)
Let’s make a change to a file (h-BinCheck.p) And commit it
hg commit
Using mercurial
Let’s see the log now hg log
What were the changes ? hg diff –r0:1 h-BinCheck.p
Let’s make more changes What is the status of my working directory ?
hg status What were the changes ?
hg diff
Using mercurial
Don’t like what you see ? hg revert (creates .orig file) hg revert –no-backup (no .orig file)
Mercurial Repositories
checkout checkin
checkout checkin
checkin checko
ut
checkin checko
ut
QA Repo Build Repo
Mercurial Repositories
A “Central” repository is useful for Providing a master repo for QA Providing a convenient repo for cloning
Hg serve Starts a webserver on port 8000 Allows a repo to be accessed by other
developers Server or developer machine Generally LAN only
Mercurial Repositories
Bitbucket http://bitbucket.org/ Free for up to 5 users Built-in issue tracking Unlimited repositories (private / public) Available wherever there is an internet
connection Demo: Create a new repository (pugus)
Creates a repository from another repository
hg clone https://bitbucket.org/jmls/pugus pugus Inits the repo Downloads the entire repository Updates the working directory
Add a new file, commit hg add hg commit
Cloning
Repository changesets
n/a
• [empty repository]
Repo @ bitbucket
0
• My initial version
Repo @ my computer
Pushing changes
Now we need to push changes up to remote repo hg push
Rinse, repeat make another change “added comments” commit, push
0
• My initial version
Repo @ bitbucket
0
• My initial version
Repo @ my computer
Pushing changes
Now we have hg push
1• Added comments
0• My initial version
Repo @ bitbucket
1• Added comments
0• My initial version
Repo @ my computer
Another developer ..
Alice has been added to the dev team Needs to clone the repository
hg clone
1• Added comments
0• My initial version
Repo @ bitbucket
1• Added comments
0• My initial version
Repo @ Alice
1• Added comments
0• My initial version
Repo @ my computer
Multiple changes
I add a new file Alice modifies readme.txt Both commit
2• Added install.txt
1• Added comments
0• My initial version
Repo @ my computer
2
• Added copyright message
1• Added comments
0• My initial version
Repo @ Alice
Alice pushes
Alice pushes to remote repo
2
• Added copyright message
1• Added comments
0• My initial version
Repo @ bitbucket
2
• Added copyright message
1• Added comments
0• My initial version
Repo @ Alice
I push
I push to remote repo Fails.
I need to get the updated changesets before I can push hg incoming
Shows all changes hg pull
Now there are 2 heads (mine and Alice’s) Working directory not updated
Alice doesn’t have the latest version
I push
4• merged changesets
3• Added install.txt
2• Added copyright message
1• Added comments
0• My initial version
Repo @ bitbucket4
• Merged changesets
3• Added copyright message
2• Added install.txt
1• Added comments
0• My initial version
Repo @ my computer
2
• Added copyright message
1• Added comments
0• My initial version
Repo @ Alice
Alice doesn’t have the latest version hg pull
No merge needed, just update hg update
Alice now has the latest version of the repository
Alice pulls
4• Merged changesets
3• Added install.txt
2• Added copyright message
1• Added comments
0• My initial version
Repo @ alice
To create a Progress view on the project
Select Project Properties Select Project Facets Select Openedge / GUI for .net Apply
Now we have a progress project with a mercurial team No more command line ;)
Mercurial Eclipse