Differences between revisions 9 and 20 (spanning 11 versions)
Revision 9 as of 2008-08-21 09:52:52
Size: 11235
Editor: abuehl
Comment:
Revision 20 as of 2012-11-06 09:04:21
Size: 8194
Editor: mpm
Comment: moinfs edit
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
=== Working Directory State === #pragma section-numbers 2
Line 3: Line 3:
Mercurial tracks various information about the [:WorkingDirectory:working directory] (the '''dirstate'''): <<Include(A:dev)>>

= Dirstate =

Internals of the directory state cache.

<<TableOfContents>>

== Introduction ==

Mercurial tracks various information about the [[WorkingDirectory|working directory]] (the '''dirstate'''):
Line 155: Line 165:
n 0 -1 unset templates/header-gitweb.tmpl
n 0 -1 unset templates/header-raw.tmpl
n 0 -1 unset templates/header-rss.tmpl
n 0 -1 unset templates/header.tmpl
n 0 -1 unset templates/index.tmpl
n 0 -1 unset templates/manifest-gitweb.tmpl
n 0 -1 unset templates/manifest.tmpl
n 0 -1 unset templates/map
n 0 -1 unset templates/map-cmdline.changelog
n 0 -1 unset templates/map-cmdline.compact
n 0 -1 unset templates/map-cmdline.default
n 0 -1 unset templates/map-gitweb
n 0 -1 unset templates/map-raw
n 0 -1 unset templates/map-rss
n 0 -1 unset templates/notfound.tmpl
n 0 -1 unset templates/search-gitweb.tmpl
n 0 -1 unset templates/search.tmpl
n 0 -1 unset templates/shortlog-gitweb.tmpl
n 0 -1 unset templates/static/hgicon.png
n 0 -1 unset templates/static/style-gitweb.css
n 0 -1 unset templates/static/style.css
n 0 -1 unset templates/summary-gitweb.tmpl
n 0 -1 unset templates/tagentry-rss.tmpl
n 0 -1 unset templates/tags-gitweb.tmpl
n 0 -1 unset templates/tags-rss.tmpl
n 0 -1 unset templates/tags.tmpl
n 0 -1 unset templates/template-vars.txt
n 0 -1 unset tests/README
n 0 -1 unset tests/fish-merge
n 0 -1 unset tests/md5sum.py
n 0 -1 unset tests/run-tests
n 0 -1 unset tests/test-addremove
n 0 -1 unset tests/test-addremove.out
n 0 -1 unset tests/test-archive
n 0 -1 unset tests/test-archive.out
...
}}}

For files having state "n" in the dirstate, Mercurial compares the file modification time and the size in the dirstate with the modification time and the size of the file in the working directory. If both the modification time ''and'' the size are the same, Mercurial will assume it has not changed and will thus not include it in the next [:Commit:commit].

Having size "-1" and date "unset" means that Mercurial assumes nothing about the contents of that file and will have to look into the file to determine whether it has changed or not. This frequently happens for fresh checkouts if the number of files are large enough. See also [http://www.selenic.com/hg/rev/af3f26b6bba4 dirstate: ignore stat data for files that were updated too recently], changeset {{{af3f26b6bba4}}} by Alexis S. L. Carvalho (introduced in Mercurial release 1.0); and an explanation given by Matt Mackall in http://selenic.com/pipermail/mercurial/2008-August/020984.html for this.

----
CategoryInternals
n 0

Note:

This page is primarily intended for developers of Mercurial.

Dirstate

Internals of the directory state cache.

Contents

  1. Introduction

1. Introduction

Mercurial tracks various information about the working directory (the dirstate):

  • what revision(s) are currently checked out
  • what files have been copied or renamed
  • what files are controlled by Mercurial

For each file that Mercurial controls, we record the following information:

  • its size
  • its mode
  • its modification time
  • its "state"

The states that are tracked are:

  • n - normal
  • a - added
  • r - removed
  • m - 3-way merged

With this information, we can quickly determine what files in the working directory have changed.

Here's a real example of a dirstate of a clone of the Mercurial repository itself:

DirState (last edited 2021-11-04 11:32:34 by RaphaelGomes)