author | Simon Sapin <simon.sapin@octobus.net> |
Fri, 15 Oct 2021 16:12:00 +0200 | |
changeset 48261 | 1730b2fceaa1 |
parent 48244 | f7fd629ffb98 |
child 48262 | dfc5a505ddc5 |
permissions | -rw-r--r-- |
48178
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
1 |
The *dirstate* is what Mercurial uses internally to track |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
2 |
the state of files in the working directory, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
3 |
such as set by commands like `hg add` and `hg rm`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
4 |
It also contains some cached data that help make `hg status` faster. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
5 |
The name refers both to `.hg/dirstate` on the filesystem |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
6 |
and the corresponding data structure in memory while a Mercurial process |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
7 |
is running. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
8 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
9 |
The original file format, retroactively dubbed `dirstate-v1`, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
10 |
is described at https://www.mercurial-scm.org/wiki/DirState. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
11 |
It is made of a flat sequence of unordered variable-size entries, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
12 |
so accessing any information in it requires parsing all of it. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
13 |
Similarly, saving changes requires rewriting the entire file. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
14 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
15 |
The newer `dirsate-v2` file format is designed to fix these limitations |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
16 |
and make `hg status` faster. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
17 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
18 |
User guide |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
19 |
========== |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
20 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
21 |
Compatibility |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
22 |
------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
23 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
24 |
The file format is experimental and may still change. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
25 |
Different versions of Mercurial may not be compatible with each other |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
26 |
when working on a local repository that uses this format. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
27 |
When using an incompatible version with the experimental format, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
28 |
anything can happen including data corruption. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
29 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
30 |
Since the dirstate is entirely local and not relevant to the wire protocol, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
31 |
`dirstate-v2` does not affect compatibility with remote Mercurial versions. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
32 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
33 |
When `share-safe` is enabled, different repositories sharing the same store |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
34 |
can use different dirstate formats. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
35 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
36 |
Enabling `dirsate-v2` for new local repositories |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
37 |
------------------------------------------------ |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
38 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
39 |
When creating a new local repository such as with `hg init` or `hg clone`, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
40 |
the `exp-dirstate-v2` boolean in the `format` configuration section |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
41 |
controls whether to use this file format. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
42 |
This is disabled by default as of this writing. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
43 |
To enable it for a single repository, run for example:: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
44 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
45 |
$ hg init my-project --config format.exp-dirstate-v2=1 |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
46 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
47 |
Checking the format of an existing local repsitory |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
48 |
-------------------------------------------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
49 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
50 |
The `debugformat` commands prints information about |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
51 |
which of multiple optional formats are used in the current repository, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
52 |
including `dirstate-v2`:: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
53 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
54 |
$ hg debugformat |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
55 |
format-variant repo |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
56 |
fncache: yes |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
57 |
dirstate-v2: yes |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
58 |
[…] |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
59 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
60 |
Upgrading or downgrading an existing local repository |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
61 |
----------------------------------------------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
62 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
63 |
The `debugupgrade` command does various upgrades or downgrades |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
64 |
on a local repository |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
65 |
based on the current Mercurial version and on configuration. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
66 |
The same `format.exp-dirstate-v2` configuration is used again. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
67 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
68 |
Example to upgrade:: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
69 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
70 |
$ hg debugupgrade --config format.exp-dirstate-v2=1 |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
71 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
72 |
Example to downgrade to `dirstate-v1`:: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
73 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
74 |
$ hg debugupgrade --config format.exp-dirstate-v2=0 |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
75 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
76 |
Both of this commands do nothing but print a list of proposed changes, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
77 |
which may include changes unrelated to the dirstate. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
78 |
Those other changes are controlled by their own configuration keys. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
79 |
Add `--run` to a command to actually apply the proposed changes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
80 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
81 |
Backups of `.hg/requires` and `.hg/dirstate` are created |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
82 |
in a `.hg/upgradebackup.*` directory. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
83 |
If something goes wrong, restoring those files should undo the change. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
84 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
85 |
Note that upgrading affects compatibility with older versions of Mercurial |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
86 |
as noted above. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
87 |
This can be relevant when a repository’s files are on a USB drive |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
88 |
or some other removable media, or shared over the network, etc. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
89 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
90 |
Internal filesystem representation |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
91 |
================================== |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
92 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
93 |
Requirements file |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
94 |
----------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
95 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
96 |
The `.hg/requires` file indicates which of various optional file formats |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
97 |
are used by a given repository. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
98 |
Mercurial aborts when seeing a requirement it does not know about, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
99 |
which avoids older version accidentally messing up a respository |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
100 |
that uses a format that was introduced later. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
101 |
For versions that do support a format, the presence or absence of |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
102 |
the corresponding requirement indicates whether to use that format. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
103 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
104 |
When the file contains a `exp-dirstate-v2` line, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
105 |
the `dirstate-v2` format is used. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
106 |
With no such line `dirstate-v1` is used. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
107 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
108 |
High level description |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
109 |
---------------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
110 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
111 |
Whereas `dirstate-v1` uses a single `.hg/disrtate` file, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
112 |
in `dirstate-v2` that file is a "docket" file |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
113 |
that only contains some metadata |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
114 |
and points to separate data file named `.hg/dirstate.{ID}`, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
115 |
where `{ID}` is a random identifier. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
116 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
117 |
This separation allows making data files append-only |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
118 |
and therefore safer to memory-map. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
119 |
Creating a new data file (occasionally to clean up unused data) |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
120 |
can be done with a different ID |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
121 |
without disrupting another Mercurial process |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
122 |
that could still be using the previous data file. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
123 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
124 |
Both files have a format designed to reduce the need for parsing, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
125 |
by using fixed-size binary components as much as possible. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
126 |
For data that is not fixed-size, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
127 |
references to other parts of a file can be made by storing "pseudo-pointers": |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
128 |
integers counted in bytes from the start of a file. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
129 |
For read-only access no data structure is needed, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
130 |
only a bytes buffer (possibly memory-mapped directly from the filesystem) |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
131 |
with specific parts read on demand. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
132 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
133 |
The data file contains "nodes" organized in a tree. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
134 |
Each node represents a file or directory inside the working directory |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
135 |
or its parent changeset. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
136 |
This tree has the same structure as the filesystem, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
137 |
so a node representing a directory has child nodes representing |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
138 |
the files and subdirectories contained directly in that directory. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
139 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
140 |
The docket file format |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
141 |
---------------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
142 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
143 |
This is implemented in `rust/hg-core/src/dirstate_tree/on_disk.rs` |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
144 |
and `mercurial/dirstateutils/docket.py`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
145 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
146 |
Components of the docket file are found at fixed offsets, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
147 |
counted in bytes from the start of the file: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
148 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
149 |
* Offset 0: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
150 |
The 12-bytes marker string "dirstate-v2\n" ending with a newline character. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
151 |
This makes it easier to tell a dirstate-v2 file from a dirstate-v1 file, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
152 |
although it is not strictly necessary |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
153 |
since `.hg/requires` determines which format to use. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
154 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
155 |
* Offset 12: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
156 |
The changeset node ID on the first parent of the working directory, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
157 |
as up to 32 binary bytes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
158 |
If a node ID is shorter (20 bytes for SHA-1), |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
159 |
it is start-aligned and the rest of the bytes are set to zero. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
160 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
161 |
* Offset 44: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
162 |
The changeset node ID on the second parent of the working directory, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
163 |
or all zeros if there isn’t one. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
164 |
Also 32 binary bytes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
165 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
166 |
* Offset 76: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
167 |
Tree metadata on 44 bytes, described below. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
168 |
Its separation in this documentation from the rest of the docket |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
169 |
reflects a detail of the current implementation. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
170 |
Since tree metadata is also made of fields at fixed offsets, those could |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
171 |
be inlined here by adding 76 bytes to each offset. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
172 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
173 |
* Offset 120: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
174 |
The used size of the data file, as a 32-bit big-endian integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
175 |
The actual size of the data file may be larger |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
176 |
(if another Mercurial processis in appending to it |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
177 |
but has not updated the docket yet). |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
178 |
That extra data must be ignored. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
179 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
180 |
* Offset 124: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
181 |
The length of the data file identifier, as a 8-bit integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
182 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
183 |
* Offset 125: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
184 |
The data file identifier. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
185 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
186 |
* Any additional data is current ignored, and dropped when updating the file. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
187 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
188 |
Tree metadata in the docket file |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
189 |
-------------------------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
190 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
191 |
Tree metadata is similarly made of components at fixed offsets. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
192 |
These offsets are counted in bytes from the start of tree metadata, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
193 |
which is 76 bytes after the start of the docket file. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
194 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
195 |
This metadata can be thought of as the singular root of the tree |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
196 |
formed by nodes in the data file. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
197 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
198 |
* Offset 0: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
199 |
Pseudo-pointer to the start of root nodes, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
200 |
counted in bytes from the start of the data file, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
201 |
as a 32-bit big-endian integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
202 |
These nodes describe files and directories found directly |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
203 |
at the root of the working directory. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
204 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
205 |
* Offset 4: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
206 |
Number of root nodes, as a 32-bit big-endian integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
207 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
208 |
* Offset 8: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
209 |
Total number of nodes in the entire tree that "have a dirstate entry", |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
210 |
as a 32-bit big-endian integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
211 |
Those nodes represent files that would be present at all in `dirstate-v1`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
212 |
This is typically less than the total number of nodes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
213 |
This counter is used to implement `len(dirstatemap)`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
214 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
215 |
* Offset 12: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
216 |
Number of nodes in the entire tree that have a copy source, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
217 |
as a 32-bit big-endian integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
218 |
At the next commit, these files are recorded |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
219 |
as having been copied or moved/renamed from that source. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
220 |
(A move is recorded as a copy and separate removal of the source.) |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
221 |
This counter is used to implement `len(dirstatemap.copymap)`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
222 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
223 |
* Offset 16: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
224 |
An estimation of how many bytes of the data file |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
225 |
(within its used size) are unused, as a 32-bit big-endian integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
226 |
When appending to an existing data file, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
227 |
some existing nodes or paths can be unreachable from the new root |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
228 |
but they still take up space. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
229 |
This counter is used to decide when to write a new data file from scratch |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
230 |
instead of appending to an existing one, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
231 |
in order to get rid of that unreachable data |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
232 |
and avoid unbounded file size growth. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
233 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
234 |
* Offset 20: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
235 |
These four bytes are currently ignored |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
236 |
and reset to zero when updating a docket file. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
237 |
This is an attempt at forward compatibility: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
238 |
future Mercurial versions could use this as a bit field |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
239 |
to indicate that a dirstate has additional data or constraints. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
240 |
Finding a dirstate file with the relevant bit unset indicates that |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
241 |
it was written by a then-older version |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
242 |
which is not aware of that future change. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
243 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
244 |
* Offset 24: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
245 |
Either 20 zero bytes, or a SHA-1 hash as 20 binary bytes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
246 |
When present, the hash is of ignore patterns |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
247 |
that were used for some previous run of the `status` algorithm. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
248 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
249 |
* (Offset 44: end of tree metadata) |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
250 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
251 |
Optional hash of ignore patterns |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
252 |
-------------------------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
253 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
254 |
The implementation of `status` at `rust/hg-core/src/dirstate_tree/status.rs` |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
255 |
has been optimized such that its run time is dominated by calls |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
256 |
to `stat` for reading the filesystem metadata of a file or directory, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
257 |
and to `readdir` for listing the contents of a directory. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
258 |
In some cases the algorithm can skip calls to `readdir` |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
259 |
(saving significant time) |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
260 |
because the dirstate already contains enough of the relevant information |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
261 |
to build the correct `status` results. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
262 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
263 |
The default configuration of `hg status` is to list unknown files |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
264 |
but not ignored files. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
265 |
In this case, it matters for the `readdir`-skipping optimization |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
266 |
if a given file used to be ignored but became unknown |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
267 |
because `.hgignore` changed. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
268 |
To detect the possibility of such a change, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
269 |
the tree metadata contains an optional hash of all ignore patterns. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
270 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
271 |
We define: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
272 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
273 |
* "Root" ignore files as: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
274 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
275 |
- `.hgignore` at the root of the repository if it exists |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
276 |
- And all files from `ui.ignore.*` config. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
277 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
278 |
This set of files is sorted by the string representation of their path. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
279 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
280 |
* The "expanded contents" of an ignore files is the byte string made |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
281 |
by the concatenation of its contents followed by the "expanded contents" |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
282 |
of other files included with `include:` or `subinclude:` directives, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
283 |
in inclusion order. This definition is recursive, as included files can |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
284 |
themselves include more files. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
285 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
286 |
This hash is defined as the SHA-1 of the concatenation (in sorted |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
287 |
order) of the "expanded contents" of each "root" ignore file. |
48195
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
288 |
(Note that computing this does not require actually concatenating |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
289 |
into a single contiguous byte sequence. |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
290 |
Instead a SHA-1 hasher object can be created |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
291 |
and fed separate chunks one by one.) |
48178
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
292 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
293 |
The data file format |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
294 |
-------------------- |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
295 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
296 |
This is implemented in `rust/hg-core/src/dirstate_tree/on_disk.rs` |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
297 |
and `mercurial/dirstateutils/v2.py`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
298 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
299 |
The data file contains two types of data: paths and nodes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
300 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
301 |
Paths and nodes can be organized in any order in the file, except that sibling |
48195
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
302 |
nodes must be next to each other and sorted by their path. |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
303 |
Contiguity lets the parent refer to them all |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
304 |
by their count and a single pseudo-pointer, |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
305 |
instead of storing one pseudo-pointer per child node. |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
306 |
Sorting allows using binary seach to find a child node with a given name |
eb8092f9304f
dirstate-v2: Use "byte sequence" in docs
Simon Sapin <simon.sapin@octobus.net>
parents:
48178
diff
changeset
|
307 |
in `O(log(n))` byte sequence comparisons. |
48178
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
308 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
309 |
The current implemention writes paths and child node before a given node |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
310 |
for ease of figuring out the value of pseudo-pointers by the time the are to be |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
311 |
written, but this is not an obligation and readers must not rely on it. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
312 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
313 |
A path is stored as a byte string anywhere in the file, without delimiter. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
314 |
It is refered to by one or more node by a pseudo-pointer to its start, and its |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
315 |
length in bytes. Since there is no delimiter, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
316 |
when a path is a substring of another the same bytes could be reused, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
317 |
although the implementation does not exploit this as of this writing. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
318 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
319 |
A node is stored on 43 bytes with components at fixed offsets. Paths and |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
320 |
child nodes relevant to a node are stored externally and referenced though |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
321 |
pseudo-pointers. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
322 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
323 |
All integers are stored in big-endian. All pseudo-pointers are 32-bit integers |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
324 |
counting bytes from the start of the data file. Path lengths and positions |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
325 |
are 16-bit integers, also counted in bytes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
326 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
327 |
Node components are: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
328 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
329 |
* Offset 0: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
330 |
Pseudo-pointer to the full path of this node, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
331 |
from the working directory root. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
332 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
333 |
* Offset 4: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
334 |
Length of the full path. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
335 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
336 |
* Offset 6: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
337 |
Position of the last `/` path separator within the full path, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
338 |
in bytes from the start of the full path, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
339 |
or zero if there isn’t one. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
340 |
The part of the full path after this position is the "base name". |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
341 |
Since sibling nodes have the same parent, only their base name vary |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
342 |
and needs to be considered when doing binary search to find a given path. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
343 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
344 |
* Offset 8: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
345 |
Pseudo-pointer to the "copy source" path for this node, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
346 |
or zero if there is no copy source. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
347 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
348 |
* Offset 12: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
349 |
Length of the copy source path, or zero if there isn’t one. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
350 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
351 |
* Offset 14: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
352 |
Pseudo-pointer to the start of child nodes. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
353 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
354 |
* Offset 18: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
355 |
Number of child nodes, as a 32-bit integer. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
356 |
They occupy 43 times this number of bytes |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
357 |
(not counting space for paths, and further descendants). |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
358 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
359 |
* Offset 22: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
360 |
Number as a 32-bit integer of descendant nodes in this subtree, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
361 |
not including this node itself, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
362 |
that "have a dirstate entry". |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
363 |
Those nodes represent files that would be present at all in `dirstate-v1`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
364 |
This is typically less than the total number of descendants. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
365 |
This counter is used to implement `has_dir`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
366 |
|
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
367 |
* Offset 26: |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
368 |
Number as a 32-bit integer of descendant nodes in this subtree, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
369 |
not including this node itself, |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
370 |
that represent files tracked in the working directory. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
371 |
(For example, `hg rm` makes a file untracked.) |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
372 |
This counter is used to implement `has_tracked_dir`. |
e8a576de703f
dirstate-v2: Add internal documentation
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
373 |
|
48200
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
374 |
* Offset 30: |
48243
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
375 |
A `flags` fields that packs some boolean values as bits of a 16-bit integer. |
48200
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
376 |
Starting from least-significant, bit masks are:: |
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
377 |
|
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
378 |
WDIR_TRACKED = 1 << 0 |
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
379 |
P1_TRACKED = 1 << 1 |
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
380 |
P2_INFO = 1 << 2 |
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
381 |
HAS_MODE_AND_SIZE = 1 << 3 |
48244
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
382 |
HAS_FILE_MTIME = 1 << 4 |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
383 |
HAS_DIRECTORY_MTIME = 1 << 5 |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
384 |
MODE_EXEC_PERM = 1 << 6 |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
385 |
MODE_IS_SYMLINK = 1 << 7 |
48261
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
386 |
EXPECTED_STATE_IS_MODIFIED = 1 << 8 |
48200
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
387 |
|
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
388 |
The meaning of each bit is described below. |
48200
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
389 |
|
48243
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
390 |
Other bits are unset. |
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
391 |
They may be assigned meaning if the future, |
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
392 |
with the limitation that Mercurial versions that pre-date such meaning |
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
393 |
will always reset those bits to unset when writing nodes. |
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
394 |
(A new node is written for any mutation in its subtree, |
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
395 |
leaving the bytes of the old node unreachable |
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
396 |
until the data file is rewritten entirely.) |
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
397 |
|
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
398 |
* Offset 32: |
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
399 |
A `size` field described below, as a 32-bit integer. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
400 |
Unlike in dirstate-v1, negative values are not used. |
48200
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
401 |
|
48243
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
402 |
* Offset 36: |
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
403 |
The seconds component of an `mtime` field described below, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
404 |
as a 32-bit integer. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
405 |
Unlike in dirstate-v1, negative values are not used. |
48244
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
406 |
When `mtime` is used, this is number of seconds since the Unix epoch |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
407 |
truncated to its lower 31 bits. |
48205
320de901896a
dirstate-v2: Truncate directory mtimes to 31 bits of seconds
Simon Sapin <simon.sapin@octobus.net>
parents:
48203
diff
changeset
|
408 |
|
48243
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
409 |
* Offset 40: |
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
410 |
The nanoseconds component of an `mtime` field described below, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
411 |
as a 32-bit integer. |
48244
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
412 |
When `mtime` is used, |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
413 |
this is the number of nanoseconds since `mtime.seconds`, |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
414 |
always stritctly less than one billion. |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
415 |
|
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
416 |
This may be zero if more precision is not available. |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
417 |
(This can happen because of limitations in any of Mercurial, Python, |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
418 |
libc, the operating system, …) |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
419 |
|
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
420 |
When comparing two mtimes and either has this component set to zero, |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
421 |
the sub-second precision of both should be ignored. |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
422 |
False positives when checking mtime equality due to clock resolution |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
423 |
are always possible and the status algorithm needs to deal with them, |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
424 |
but having too many false negatives could be harmful too. |
48200
77fc340acad7
dirstate-v2: Document flags/mode/size/mtime fields of tree nodes
Simon Sapin <simon.sapin@octobus.net>
parents:
48195
diff
changeset
|
425 |
|
48243
0524c1359bfc
dirstate-v2: Extend node flags to 16 bits
Simon Sapin <simon.sapin@octobus.net>
parents:
48231
diff
changeset
|
426 |
* (Offset 44: end of this node) |
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
427 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
428 |
The meaning of the boolean values packed in `flags` is: |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
429 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
430 |
`WDIR_TRACKED` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
431 |
Set if the working directory contains a tracked file at this node’s path. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
432 |
This is typically set and unset by `hg add` and `hg rm`. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
433 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
434 |
`P1_TRACKED` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
435 |
Set if the working directory’s first parent changeset |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
436 |
(whose node identifier is found in tree metadata) |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
437 |
contains a tracked file at this node’s path. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
438 |
This is a cache to reduce manifest lookups. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
439 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
440 |
`P2_INFO` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
441 |
Set if the file has been involved in some merge operation. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
442 |
Either because it was actually merged, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
443 |
or because the version in the second parent p2 version was ahead, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
444 |
or because some rename moved it there. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
445 |
In either case `hg status` will want it displayed as modified. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
446 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
447 |
Files that would be mentioned at all in the `dirstate-v1` file format |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
448 |
have a node with at least one of the above three bits set in `dirstate-v2`. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
449 |
Let’s call these files "tracked anywhere", |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
450 |
and "untracked" the nodes with all three of these bits unset. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
451 |
Untracked nodes are typically for directories: |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
452 |
they hold child nodes and form the tree structure. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
453 |
Additional untracked nodes may also exist. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
454 |
Although implementations should strive to clean up nodes |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
455 |
that are entirely unused, other untracked nodes may also exist. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
456 |
For example, a future version of Mercurial might in some cases |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
457 |
add nodes for untracked files or/and ignored files in the working directory |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
458 |
in order to optimize `hg status` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
459 |
by enabling it to skip `readdir` in more cases. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
460 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
461 |
`HAS_MODE_AND_SIZE` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
462 |
Must be unset for untracked nodes. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
463 |
For files tracked anywhere, if this is set: |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
464 |
- The `size` field is the expected file size, |
48261
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
465 |
in bytes truncated its lower to 31 bits. |
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
466 |
- The expected execute permission for the file’s owner |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
467 |
is given by `MODE_EXEC_PERM` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
468 |
- The expected file type is given by `MODE_IS_SIMLINK`: |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
469 |
a symbolic link if set, or a normal file if unset. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
470 |
If this is unset the expected size, permission, and file type are unknown. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
471 |
The `size` field is unused (set to zero). |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
472 |
|
48244
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
473 |
`HAS_FILE_MTIME` |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
474 |
Must be unset for untracked nodes. |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
475 |
If this and `HAS_DIRECTORY_MTIME` are both unset, |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
476 |
the `mtime` field is unused (set to zero). |
48261
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
477 |
If this is set, `mtime` is the expected modification time. |
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
478 |
|
48244
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
479 |
`HAS_DIRECTORY_MTIME` |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
480 |
Must be unset for file tracked anywhere. |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
481 |
If this and `HAS_DIRECTORY_MTIME` are both unset, |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
482 |
the `mtime` field is unused (set to zero). |
f7fd629ffb98
dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags
Simon Sapin <simon.sapin@octobus.net>
parents:
48243
diff
changeset
|
483 |
If this is set, at some point, |
48231
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
484 |
this path in the working directory was observed: |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
485 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
486 |
- To be a directory |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
487 |
- With the modification time given in `mtime` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
488 |
- That time was already strictly in the past when observed, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
489 |
meaning that later changes cannot happen in the same clock tick |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
490 |
and must cause a different modification time |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
491 |
(unless the system clock jumps back and we get unlucky, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
492 |
which is not impossible but deemed unlikely enough). |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
493 |
- All direct children of this directory |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
494 |
(as returned by `std::fs::read_dir`) |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
495 |
either have a corresponding dirstate node, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
496 |
or are ignored by ignore patterns whose hash is in tree metadata. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
497 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
498 |
This means that if `std::fs::symlink_metadata` later reports |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
499 |
the same modification time |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
500 |
and ignored patterns haven’t changed, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
501 |
a run of status that is not listing ignored files |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
502 |
can skip calling `std::fs::read_dir` again for this directory, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
503 |
and iterate child dirstate nodes instead. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
504 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
505 |
`MODE_EXEC_PERM` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
506 |
Must be unset if `HAS_MODE_AND_SIZE` is unset. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
507 |
If `HAS_MODE_AND_SIZE` is set, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
508 |
this indicates whether the file’s own is expected |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
509 |
to have execute permission. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
510 |
|
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
511 |
`MODE_IS_SYMLINK` |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
512 |
Must be unset if `HAS_MODE_AND_SIZE` is unset. |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
513 |
If `HAS_MODE_AND_SIZE` is set, |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
514 |
this indicates whether the file is expected to be a symlink |
308d9c245337
dirstate-v2: Add storage space for nanoseconds precision in file mtimes
Simon Sapin <simon.sapin@octobus.net>
parents:
48207
diff
changeset
|
515 |
as opposed to a normal file. |
48261
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
516 |
|
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
517 |
`EXPECTED_STATE_IS_MODIFIED` |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
518 |
Must be unset for untracked nodes. |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
519 |
For: |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
520 |
- a file tracked anywhere |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
521 |
- that has expected metadata (`HAS_MODE_AND_SIZE` and `HAS_FILE_MTIME`) |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
522 |
- if that metadata matches |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
523 |
metadata found in the working directory with `stat` |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
524 |
This bit indicates the status of the file. |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
525 |
If set, the status is modified. If unset, it is clean. |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
526 |
|
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
527 |
In cases where `hg status` needs to read the contents of a file |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
528 |
because metadata is ambiguous, this bit lets it record the result |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
529 |
if the result is modified so that a future run of `hg status` |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
530 |
does not need to do the same again. |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
531 |
It is valid to never set this bit, |
1730b2fceaa1
dirstate-v2: adds a flag to mark a file as modified
Simon Sapin <simon.sapin@octobus.net>
parents:
48244
diff
changeset
|
532 |
and consider expected metadata ambiguous if it is set. |