Version Control With Mercurial and Progress Overview Introduction



























![Repository changesets Repo @ bitbucket n/a • [empty repository] Repo @ my computer 0 Repository changesets Repo @ bitbucket n/a • [empty repository] Repo @ my computer 0](https://slidetodoc.com/presentation_image_h2/f12527ced992f1dda6a377fd6ca221ea/image-28.jpg)

















- Slides: 45

Version Control With Mercurial and Progress

Overview Introduction What is version control ? Why use version control ? Centralised vs. Distributed Why Mercurial ? Using Mercurial [with Progress] Examples / Demos Questions

Introduction Julian Lyndon-Smith, dot. r limited Progress developer since v 3 Fan of vcs since 1987 Developed, sold Boss (Progress-based vcs) Other vcs systems used include Roundtable ~1992 -1994 Source. Safe ~1994 -1998 Cvs ~1998 -2004 Subversion ~2004 -2011

What is version control? 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

Why use 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

Centralised vcs checkin checkout

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 QA Repo Build Repo checkout

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

Weaknesses Who has the “latest” version ? Large Binary files Fixed in later releases Mindset

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 The basics

Using mercurial Download from http: //mercurial. selenic. com/ Update settings

Using mercurial Download from 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-Bin. Check. p) And commit it hg commit

Using mercurial Let’s see the log now hg log What were the changes ? hg diff –r 0: 1 h-Bin. Check. 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 QA Repo Build Repo checkout

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)

Cloning Creates a repository from another repository hg clone https: //bitbucket. org/jmls/pugus Inits the repo Downloads the entire repository Updates the working directory Add a new file, commit hg add hg commit
![Repository changesets Repo bitbucket na empty repository Repo my computer 0 Repository changesets Repo @ bitbucket n/a • [empty repository] Repo @ my computer 0](https://slidetodoc.com/presentation_image_h2/f12527ced992f1dda6a377fd6ca221ea/image-28.jpg)
Repository changesets Repo @ bitbucket n/a • [empty repository] Repo @ my computer 0 • My initial version

Pushing changes Now we need to push changes up to remote repo hg push Repo @ bitbucket 0 • My initial version Repo @ my computer 0 • My initial version Rinse, repeat make another change “added comments” commit, push

Pushing changes Now we have hg push Repo @ bitbucket Repo @ my computer 1 • Added comments 0 • My initial version

Another developer. . Alice has been added to the dev team Needs to clone the repository hg clone Repo @ bitbucket Repo @ Alice 1 • Added comments 0 • My initial version Repo @ my computer 1 • Added comments 0 • My initial version

Multiple changes I add a new file Alice modifies readme. txt Both commit Repo @ my computer 2 • Added install. txt 1 • Added comments 0 • My initial version Repo @ Alice 2 • Added copyright message 1 • Added comments 0 • My initial version

Alice pushes to remote repo Repo @ bitbucket 2 • Added copyright message 1 • Added comments 0 • My initial version Repo @ Alice 2 • Added copyright message 1 • Added comments 0 • My initial version

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

I push Merge the two heads hg merge Updates working directory hg commit hg push

I push Alice doesn’t have the latest version Repo @ Alice 2 • Added copyright message 1 • Added comments 0 • My initial version Repo @ bitbucket Repo @ my computer 4 • merged changesets 4 • Merged changesets 3 • Added install. txt 3 • Added copyright message 2 • Added install. txt 1 • Added comments 0 • My initial version

Alice pulls 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 Repo @ alice 4 • Merged changesets 3 • Added install. txt 2 • Added copyright message 1 • Added comments 0 • My initial version

General workflow pull push update Make changes Commit Test commit Merge Pull

Workbench demo

Mercurial Eclipse Help => Install new Software

Mercurial Eclipse Create new Progress project File => New=>Other



Mercurial Eclipse 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 ; )

Demos, Questions, Debate