Differences between revisions 7 and 19 (spanning 12 versions)
Revision 7 as of 2008-08-20 23:33:09
Size: 2426
Editor: abuehl
Comment: af3f26b6bba4 was first released in Mercurial 1.0
Revision 19 as of 2012-11-06 09:04:17
Size: 4098
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 25: Line 35:
Here's an example of the dirstate: Here's a real example of a dirstate of a clone of the Mercurial repository itself:
Line 28: Line 38:
$ hg parents -q
1224:cc61d366bc3b
$ hg debugstate
n 644 168 08/19/05 17:42:17 .hgignore
n 644 412 08/20/05 01:46:57 .hgtags
n 644 1328 08/26/05 23:22:20 CONTRIBUTORS
n 644 17992 06/30/05 10:19:51 COPYING
n 644 459 08/24/05 00:38:20 MANIFEST.in
n 644 512 08/24/05 00:35:02 Makefile
n 644 232 06/30/05 10:19:51 PKG-INFO
n 644 2736 08/20/05 00:48:33 README
n 644 1676 06/30/05 10:19:51 comparison.txt
n 644 3711 12/31/69 15:59:59 contrib/bash_completion
n 711 1305 07/01/05 15:04:52 contrib/buildrpm
n 755 8300 08/16/05 16:03:59 contrib/convert-repo
n 644 69 06/30/05 10:19:51 contrib/git-viz/git-cat-file
n 644 69 06/30/05 10:19:51 contrib/git-viz/git-diff-tree
n 644 69 06/30/05 10:19:51 contrib/git-viz/git-rev-list
n 644 69 06/30/05 10:19:51 contrib/git-viz/git-rev-tree
n 644 457 06/30/05 10:19:51 contrib/git-viz/hg-viz
n 755 8039 08/16/05 16:03:59 contrib/hgit
n 755 40043 06/30/05 10:19:51 contrib/hgk
...
}}}
> hg up -q -C null
Line 53: Line 40:
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 not include it in the next [:Commit:commit]. > hg up -C -r 2000
286 files updated, 0 files merged, 0 files removed, 0 files unresolved
Line 55: Line 43:
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
> hg debugstate
n 666 204 2008-08-21 11:29:20 .hgignore
n 666 502 2008-08-21 11:29:20 .hgtags
n 666 1508 2008-08-21 11:29:20 CONTRIBUTORS
n 666 17992 2008-08-21 11:29:20 COPYING
n 666 486 2008-08-21 11:29:20 MANIFEST.in
n 666 555 2008-08-21 11:29:20 Makefile
n 666 2733 2008-08-21 11:29:20 README
n 666 1669 2008-08-21 11:29:20 comparison.txt
n 666 3229 2008-08-21 11:29:20 contrib/bash_completion
n 666 1305 2008-08-21 11:29:20 contrib/buildrpm
n 666 8721 2008-08-21 11:29:20 contrib/convert-repo
n 666 2058 2008-08-21 11:29:20 contrib/favicon.ico
n 666 69 2008-08-21 11:29:20 contrib/git-viz/git-cat-file
n 666 69 2008-08-21 11:29:20 contrib/git-viz/git-diff-tree
n 666 69 2008-08-21 11:29:20 contrib/git-viz/git-rev-list
n 666 69 2008-08-21 11:29:20 contrib/git-viz/git-rev-tree
n 666 457 2008-08-21 11:29:20 contrib/git-viz/hg-viz
n 666 3534 2008-08-21 11:29:20 contrib/hg-menu.vim
n 666 1681 2008-08-21 11:29:20 contrib/hg-ssh
n 666 3048 2008-08-21 11:29:20 contrib/hgdiff
n 666 97510 2008-08-21 11:29:20 contrib/hgk
n 666 11664 2008-08-21 11:29:20 contrib/hgk.py
n 666 1987 2008-08-21 11:29:20 contrib/macosx/Readme.html
n 666 668 2008-08-21 11:29:20 contrib/macosx/Welcome.html
n 666 266 2008-08-21 11:29:20 contrib/macosx/macosx-build.txt
n 666 37273 2008-08-21 11:29:20 contrib/mercurial.el
n 666 1004 2008-08-21 11:29:20 contrib/mercurial.spec
n 666 1227 2008-08-21 11:29:20 contrib/tcsh_completion
n 666 1902 2008-08-21 11:29:20 contrib/tcsh_completion_build.sh
n 666 4288 2008-08-21 11:29:20 contrib/win32/ReadMe.html
n 666 1264 2008-08-21 11:29:20 contrib/win32/mercurial.ini
n 666 2390 2008-08-21 11:29:20 contrib/win32/mercurial.iss
n 666 1920 2008-08-21 11:29:20 contrib/win32/postinstall.txt
n 666 1194 2008-08-21 11:29:20 contrib/win32/win32-build.txt
n 666 16852 2008-08-21 11:29:20 contrib/zsh_completion
n 666 457 2008-08-21 11:29:20 doc/Makefile
n 666 529 2008-08-21 11:29:20 doc/README
n 666 2727 2008-08-21 11:29:20 doc/gendoc.py
n 666 6928 2008-08-21 11:29:20 doc/hg.1.txt
n 666 827 2008-08-21 11:29:20 doc/hgmerge.1.txt
n 666 11992 2008-08-21 11:29:20 doc/hgrc.5.txt
n 666 350 2008-08-21 11:29:20 doc/ja/Makefile
n 666 13642 2008-08-21 11:29:20 doc/ja/docbook.ja.conf
n 666 734 2008-08-21 11:29:20 doc/ja/docbook.ja.xsl
n 666 40128 2008-08-21 11:29:20 doc/ja/hg.1.ja.txt
n 666 1090 2008-08-21 11:29:20 doc/ja/hgmerge.1.ja.txt
n 666 8097 2008-08-21 11:29:20 doc/ja/hgrc.5.ja.txt
n 666 307 2008-08-21 11:29:20 hg
n 666 1138 2008-08-21 11:29:20 hgeditor
n 666 14 2008-08-21 11:29:20 hgext/__init__.py
n 666 8552 2008-08-21 11:29:20 hgext/gpg.py
n 666 10097 2008-08-21 11:29:20 hgext/hbisect.py
n 666 45715 2008-08-21 11:29:20 hgext/mq.py
n 666 10124 2008-08-21 11:29:20 hgext/patchbomb.py
n 666 592 2008-08-21 11:

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)