Differences between revisions 35 and 36
Revision 35 as of 2008-04-07 22:09:45
Size: 2519
Editor: abuehl
Comment: +cat
Revision 36 as of 2009-05-19 19:31:03
Size: 2526
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
[[TableOfContents]] <<TableOfContents>>
Line 8: Line 8:
position in the project history. See ["Nodeid"]. position in the project history. See [[Nodeid]].
Line 11: Line 11:
data structure and represents all versions of a file. See ["Revlog"]. data structure and represents all versions of a file. See [[Revlog]].
Line 14: Line 14:
its nodeid to specify which version. See ["Manifest"]. its nodeid to specify which version. See [[Manifest]].
Line 17: Line 17:
description and metadata like user and date. See ["ChangeSet"]. description and metadata like user and date. See [[ChangeSet]].
Line 52: Line 52:
The other piece of Mercurial is the [:WorkingDirectory:working directory]. Mercurial tracks various information about the working directory. See DirState. The other piece of Mercurial is the [[WorkingDirectory|working directory]]. Mercurial tracks various information about the working directory. See DirState.
Line 56: Line 56:
See ["Merge"]. See [[Merge]].
Line 60: Line 60:
See ["Rollback"]. See [[Rollback]].
Line 63: Line 63:
 * ''"Towards a Better SCM: Revlog and Mercurial"'', Matt Mackall ([attachment:Presentations/ols-mercurial-paper.pdf PDF])
 * ''[http://hgbook.red-bean.com/hgbookch4.html#x8-640004 "Behind the scenes"]'' in ''[http://hgbook.red-bean.com/hgbook.html "Distributed revision control with Mercurial"]'', Bryan O’Sullivan
 * ''"Towards a Better SCM: Revlog and Mercurial"'', Matt Mackall ([[attachment:Presentations/ols-mercurial-paper.pdf|PDF]])
 * ''[[http://hgbook.red-bean.com/hgbookch4.html#x8-640004|"Behind the scenes"]]'' in ''[[http://hgbook.red-bean.com/hgbook.html|"Distributed revision control with Mercurial"]]'', Bryan O’Sullivan
Line 66: Line 66:
see also: ["Presentations"] see also: [[Presentations]]

(for details from a source code point of view, see WhatGoesWhere)

Data structures

Nodeids are unique ids that represent the contents of a file and its position in the project history. See Nodeid.

A revlog, for example .hg/data/somefile.d, is the most important data structure and represents all versions of a file. See Revlog.

A manifest describes the state of a project by listing each file and its nodeid to specify which version. See Manifest.

A changeset lists all files changed in a checkin along with a change description and metadata like user and date. See ChangeSet.

Putting it all together

We now have enough information to see how this all works together. To look up a given revision of a file:

  • look up the changeset in the changeset index
  • reconstruct the changeset data from the revlog
  • look up the manifest nodeid from the changeset in the manifest index
  • reconstruct the manifest for that revision
  • find the nodeid for the file in that revision
  • look up the revision of that file in the file's index
  • reconstruct the file revision from the revlog

If we want to go the other way and find the changeset associated with a given file revision, we follow the linkrev.

   .--------linkrev-------------.
   v                            |
.---------.    .--------.    .--------.
|changeset| .->|manifest| .->|file    |---.
|index    | |  |index   | |  |index   |   |--.
`---------' |  `--------' |  `--------'   |  |
    |       |      |      |     | `-------'  |
    V       |      V      |     V    `-------'
.---------. |  .--------. |  .---------.
|changeset|-'  |manifest|-'  |file     |
|data     |    |data    |    |revision |
`---------'    `--------'    `---------'

Tracking Working Directory State

The other piece of Mercurial is the working directory. Mercurial tracks various information about the working directory. See DirState.

Merging

See Merge.

Rollback

See Rollback.

References

see also: Presentations


CategoryInternals

Design (last edited 2013-10-08 10:26:58 by MattiJagula)