## Chapter 1. Using Mercurial with Smalltalk/X

This chapter describes how to use Mercurial with Smalltalk/X. By its nature, this document is, and always be incomplete a not up-to-date. Please report inconsistencies to the autor, preferably using bug tracker (see Section 3.1, “Bug reporting” for details).

## 1. Step-by-Step Example

Abstract

Short tutorial describes how to use Mercurial within Smalltalk/X environment for the impatient.

Thorough this tutorial, we will use a fictious package jv:hg_tutorial.

### 1.1. Setting up a Mercurial Repository

Create or clone your repository in your so-called package path as usual. Like in Java, package sources must be located in directory whose name matches a package name. For package named jv:hg_tutorial the directory would be jv/hg_tutorial, for paclkage stx:goodies/sunit it would be stx/goodies/sunit. To check content of your package path, inspect:

Smalltalk packagePath

You may add your own directories to a Smalltalk/X package path by evaluating

Smalltalk packagePath add: 'C:\path\to\your\packages'.

To make it permanent, add the above snippet to your user startup script (%USERPROFILE%\.smalltalk\p_%USERNAME%.rc on Windows, ${HOME}/.smalltalk/p_${USER}.rc on UNIX.).

So, let's create an empty mercurial repository in C:\Users\jv\.smalltalk\packages (a default location for user packages):

cd \Users\jv\.smalltalk\packages
mkdir jv
hg init jv\hg_tutorial


If there is already a repository, just clone it like:

cd \Users\jv\.smalltalk\packages
mkdir jv
hg clone https://bitbucket.org/janvrany/jv-hg_tutorial jv\hg_tutorial


### 1.2. Setting up Smalltalk/X to use Mercurial Repository

Second step is to configure your Smalltalk/X IDE to use Mercurial for your packages. Open settings (in Launcher select SystemSettings, go to Source Code Management and press to add a new package mapping. Enter a package name (jv:hg_tutorial) and select Mercurial+ as source code manager. Don't forget to apply and save your settings.

### Note

Make sure you have selected Mercurial+ and not Mercurial (without plus and the end), Mercurial without plus refer to and older attempt to build a Mercurial integration which was never finished and probably will vanish soon.

A source code manager for given package is searched by matching package if match patter against the actual package name from top to bottom. First matching is used. You may want to test your setting; to do so, just press button to open test tool.

### Note

Do not forget to tick Show in Menus checkbox in Mercurial-specific settings, otherwise menu items for working with Mercurial won't be shown. Refer to for Section 2, “Setting Up Mercurial”details.