setup mercurial repository

this tutorial will share how to install mercurial in Ubuntu, and clone openbravo using mercurial. mercurial is one of repository and code versioning control application that used by openbravo. once you have cloned openbravo using mercurial, anytime openbravo release new version, its faster to clone update from openbravo repository, instead of download it separately from source forgefisrt step is install mercurial in Ubuntu using apt

sudo apt-get install mercurial diffuse tortoisehg python-iniparse

diffuse is needed to merge code when conflic arise. tortoisehg is ghrapical tools to manage yor repository. python-iniparse used by tortoisehg to rename your repository. after installation from apt completed, you need to check hg version to validate your installation

hg version

next step, you need to define mercurial config file

cd ~;
touch .hgrc

edit your .hgrc

nano .hgrc

add lines below:

# Mercurial configuration file
# See hgrc(5) for more information
# User Interface settings
 username= your_name <>

save and exit. create your repository folder:

mkdir myrepo
cd myrepo

initialize your repository folder

hg init

open your tortoise hg, click file | open repository, then point to your initialized repository folder.

From openbravo tutorial

you will get blank repository since no file committed to this repository.
by default, your repository name is equal to folder name, you may rename it. right click on your repository that you just added, select rename, then put your desired repository name. this is just for displaying repo name in tortoisehg, no changes on your repository file or configuration.

From openbravo tutorial

add some code of openbravo to repository folder. for case study, I will use module files of openbravo wirabumi.

From openbravo tutorial

refresh tortoise, you will get files list just added to your repository.

From openbravo tutorial

check all, write some message to your 1st commit, i.e: “init”, then click commit. your code now committed to repository, and 1 revision created.

From openbravo tutorial
From openbravo tutorial

to simulate code revision or update, I will use another folder, containing module files Indonesia translation, then modify some files. for instance, I will modify ad_field.xml, add extra description to a field. copy-paste your modified file to repository folder. on your tortoisehg, refesh, you will get 1 row indicating modified file.

From openbravo tutorial

double click, tortois will open diffuse (remember your .hgrc that tell diffuse is selected merge tool). left part is your original version, right part is your modified code.

From openbravo tutorial

if you think modified code is correct one, then nothing to do. otherwise, you can copy-paste from left to right by press CTRL+LEFT_ARROW. to go to next conflict line, pres CTRL+DOWN_ARROW. save once done.
your activities above is called merging. after all codes merged, now you ready to commit. please make a note for this commit, let say “test revision”, then click commit.

From openbravo tutorial

code committed, now you have 2 revision in your repository. you may need to extract specific version form your repository, not alway latest one. just click your revision number, right click, select archive, specify which folder to archive, then click archive. now on your selected folder containing selected version that you archive.

From openbravo tutorial

now you have hands-on experience on using mercurial.
to clone openbravo code, base on, make your openbravo folder

mkdir openbravo-repo
cd openbravo-repo

creating local pristines clones

hg clone

this cloning process take several hours, depend on your intenet speed. once done, you can see revision using tortoisehg.

this is how to keeping local pristines clones up to date

hg pull -u

now you are ready with mercurial clones of openbravo, next you may want to setup eclipse IDE for openbravo.


One thought on “setup mercurial repository

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s