Differences between revisions 1 and 15 (spanning 14 versions)
Revision 1 as of 2005-08-26 00:58:38
Size: 329
Editor: waste
Comment:
Revision 15 as of 2008-01-16 10:21:51
Size: 3416
Editor: abuehl
Comment: RevlogNG interleaving
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
A repository (often abbreviated "repo") is a collection of metadata that allows the reconstruction of any version of the source code to a software project. The metadata describes the history of changes to the files and directories in the repository. These changes are grouped together into ChangeSet form. ''(for a short intro of the basic concepts of Mercurial, see UnderstandingMercurial)''

A '''repository''' is a directory (the repository directory or "repo" directory) which contains a subdirectory named {{{.hg}}} (dot hg) where Mercurial stores its internal data structures. Everything else (files and other subdirectories) in the repo directory is conceptually part of the [:WorkingDirectory:working directory], which is tracked by Mercurial (some files and subdirectories may be ignored. See [".hgignore"]).

[[TableOfContents]]

=== Creation ===

An existing, already populated but yet untracked directory can be transformed into a repository with {{{hg init}}}, which creates and initializes the {{{.hg}}} subdirectory.


=== Tracking Files ===

A file in the working directory that shall be tracked by Mercurial must be added with {{{hg add}}}. [:LocalModifications:Local modifications] to tracked files in the working directory can be [:Commit:committed] with {{{hg commit}}}, which adds a new [:ChangeSet:changeset] to the repository by recording it in the {{{.hg}}} directory.

The working directory can be restored with {{{hg update}}} to any previously committed state by specifying the requested changeset with its [:ChangeSetID:changeset ID].

The last transaction in a repository can be undone with {{{hg rollback}}} (see ["Rollback"]).


=== Transferring Changesets and Cloning ===

Changesets can be transferred from one repository to another with {{{hg pull}}}, {{{hg push}}}, {{{hg export}}} and {{{hg import}}} (see ["Pull"], ["Push"], ["Export"], ["Import"], ["CommunicatingChanges"]).

Repositories can be [:Clone:cloned] with {{{hg clone}}}.


=== Checking Integrity ===

Checking the internal integrity of a repository (the contents of {{{.hg}}}) can be done with {{{hg verify}}}.


=== Structure ===

The {{{.hg}}} directory of a repository contains (incomplete listing):

 * The [:Manifest:manifest] — Files {{{.hg/store/00manifest.i}}} and {{{.hg/store/00manifest.d}}}
    Describes the file contents of the repository at a particular changeset ID. Stored in [:Revlog:revlog] format.
 * The [:Changelog:changelog] — Files {{{.hg/store/00changelog.i}}} and {{{.hg/store/00changelog.d}}}
    Contains all changesets. Stored in revlog format.
 * A revlog per tracked file &mdash; Files {{{.hg/store/data/<encoded path>.i}}} and {{{.hg/store/data/<encoded path>.d}}}
    {{{<encoded path>}}} is the path of the tracked file in the working directory, encoded according to [:CaseFoldingPlan].

Note that for small revlogs, the revlog data file ({{{*.d}}}) may be missing, because its content may be interleaved into the corresponding index file ({{{*.i}}}) (see also ["RevlogNG"]).

=== Backup ===

Backing up a repository can be done by using push/pull/clone to a backup repository. A repository which is not actively written to (by other processes concurrently running on the computer) can be backed-up by backing-up the repo directory using normal directory/file backup procedures (like tar, zip, etc). The {{{.hg}}} directory is [:CaseFolding:case folding] tolerant, which means, it can for example be copied onto a FAT filesystem (see also ["BackUp"], ["CaseFoldingPlan"]).


=== See also ===

 * ManPages
 * RepositoryNaming
 * PublishingRepositories
 * RepositoryConversion

----
CategoryGlossary

Repository

(for a short intro of the basic concepts of Mercurial, see UnderstandingMercurial)

A repository is a directory (the repository directory or "repo" directory) which contains a subdirectory named .hg (dot hg) where Mercurial stores its internal data structures. Everything else (files and other subdirectories) in the repo directory is conceptually part of the [:WorkingDirectory:working directory], which is tracked by Mercurial (some files and subdirectories may be ignored. See [".hgignore"]).

TableOfContents

1. Creation

An existing, already populated but yet untracked directory can be transformed into a repository with hg init, which creates and initializes the .hg subdirectory.

2. Tracking Files

A file in the working directory that shall be tracked by Mercurial must be added with hg add. [:LocalModifications:Local modifications] to tracked files in the working directory can be [:Commit:committed] with hg commit, which adds a new [:ChangeSet:changeset] to the repository by recording it in the .hg directory.

The working directory can be restored with hg update to any previously committed state by specifying the requested changeset with its [:ChangeSetID:changeset ID].

The last transaction in a repository can be undone with hg rollback (see ["Rollback"]).

3. Transferring Changesets and Cloning

Changesets can be transferred from one repository to another with hg pull, hg push, hg export and hg import (see ["Pull"], ["Push"], ["Export"], ["Import"], ["CommunicatingChanges"]).

Repositories can be [:Clone:cloned] with hg clone.

4. Checking Integrity

Checking the internal integrity of a repository (the contents of .hg) can be done with hg verify.

5. Structure

The .hg directory of a repository contains (incomplete listing):

  • The [:Manifest:manifest] — Files .hg/store/00manifest.i and .hg/store/00manifest.d

    • Describes the file contents of the repository at a particular changeset ID. Stored in [:Revlog:revlog] format.

  • The [:Changelog:changelog] — Files .hg/store/00changelog.i and .hg/store/00changelog.d

    • Contains all changesets. Stored in revlog format.
  • A revlog per tracked file — Files .hg/store/data/<encoded path>.i and .hg/store/data/<encoded path>.d

    • <encoded path> is the path of the tracked file in the working directory, encoded according to [:CaseFoldingPlan].

Note that for small revlogs, the revlog data file (*.d) may be missing, because its content may be interleaved into the corresponding index file (*.i) (see also ["RevlogNG"]).

6. Backup

Backing up a repository can be done by using push/pull/clone to a backup repository. A repository which is not actively written to (by other processes concurrently running on the computer) can be backed-up by backing-up the repo directory using normal directory/file backup procedures (like tar, zip, etc). The .hg directory is [:CaseFolding:case folding] tolerant, which means, it can for example be copied onto a FAT filesystem (see also ["BackUp"], ["CaseFoldingPlan"]).

7. See also


CategoryGlossary

Repository (last edited 2013-03-25 18:30:23 by 208)