MacHg icon

About Repositories

For any revision control system a repository, in general, is just a normal directory tree, containing normal files and folders, except that a historical record is kept of the state of this collection of files at times the user(s) of the repository would like to record. In the revision control system Mercurial, the different phases of the files are recorded in a hidden directory with the name “.hg” in the top directory of the repository.

In Mercurial the archived versions of the files are stored in a compressed form. After making changes to the files, or adding or removing files or folders, the user can then “commit” these changes to the repository which tells Mercurial to record the changes in its history. Then at a later stage the user can compare the current files to historical versions of these files, find out when some line of code changed, revert some file to a previous version if desired, and other similar operations.

Thus a Mercurial repository is just a normal folder with standard contents, except that an historical record of the changes is stored in the meta-data (the ".hg" directory at the root level of the repository).

Every Mercurial repository is complete, self-contained, and independent. It contains its own private copy of a project's files and history in the .hg directory at the root of the repository.

The contents of the .hg directory and its subdirectories are private to Mercurial. Every other file and directory in the repository is yours to do with as you please. In Mercurial terminology, the .hg directory is the real repository, and all of the files and directories that coexist with it are said to live in the working directory. An easy way to remember the distinction is that the repository contains the history of your project, while the working directory contains a snapshot of your project at a particular "commit" point in history.

Local Repositories

A local repository is a repository that is resident on your local machine.

Server Repositories

A server repository is a repository that is resident on a server and not resident on your local machine. Since such a repository is on a server, MacHg will only record a reference to it. To work with such a remote repository, you must first clone it to a local clone on your machine and then work with this local repository.

Related Topics

About MacHg Documents

Create a new Repository

Manage an existing Repository

Clone a Repository

View the files in a Repository

View the history of a Repository

Pull changes from other Repositories into your Repository

Push changes in your Repository to other Repositories

About Repository Identities

External Links

Definitive Guide : Working with a repository

Definitive Guide : revision control primer