Differences between revisions 1 and 7 (spanning 6 versions)
Revision 1 as of 2008-01-13 10:48:32
Size: 1168
Editor: abuehl
Comment: extract from Design page
Revision 7 as of 2012-11-06 16:11:29
Size: 1312
Editor: abuehl
Comment: remove link to deleted page "parent"
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
Nodeids are unique ids that represent the contents of a file ''and'' its '''Nodeids''' are unique ids that represent the contents of a file ''and'' its
Line 5: Line 5:
SHA1 hash function, which generates 160 bits (40 hex digits). If you [[http://en.wikipedia.org/wiki/SHA_hash_functions|SHA1 hash function]],
which generates 160 bits (40 hex digits). If you
Line 19: Line 20:
  ''Note: The short-form notation for SHA1 hash values in Mercurial is    ''Note: The short-form notation for SHA1 hash values in Mercurial is
Line 22: Line 23:
  as it is unambiguous (see also ["ChangeSetID"]).''   as it is unambiguous (see also [[ChangeSetID]]).''
Line 25: Line 26:
as the empty root revision. This has the nice property that otherwise unrelated
revisions have a common empty ancestor.
as the empty root [[Revision|revision]]. This has the nice property that otherwise
unrelated revisions have a common empty ancestor.

Nodeids are used in [[Revlog|revlogs]].

[[FrenchNodeid|Français]]

Nodeids

Nodeids are unique ids that represent the contents of a file and its position in the project history. For now they are computed using the SHA1 hash function, which generates 160 bits (40 hex digits). If you modify a file, commit the change, and then modify it to restore the original contents, the contents are the same but the history is different, so the file will get a new nodeid. This history-sensitivity is obtained by calculating the nodeid from the concatentation of the parent nodeids with the file's contents.

Nodeids are typically presented to the user as shortened hex strings, like this:

$ hg id
8d43f8c0b836 tip
  • Note: The short-form notation for SHA1 hash values in Mercurial is the substring of the first 12 characters of the hex string representation of the full SHA1 value. The short form can also be entered in commands, as long as it is unambiguous (see also ChangeSetID).

The nodeid 00000... is special and is known as the nullid. It serves as the empty root revision. This has the nice property that otherwise unrelated revisions have a common empty ancestor.

Nodeids are used in revlogs.

Français

Nodeid (last edited 2014-12-03 01:50:13 by KyleLippincott)