Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
a0520226
Commit
a0520226
authored
7 years ago
by
Mark Thomas
Browse files
Options
Downloads
Patches
Plain Diff
dirstate: document dirstatemap interface
Differential Revision:
https://phab.mercurial-scm.org/D1380
parent
cd4cd7b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/dirstate.py
+39
-2
39 additions, 2 deletions
mercurial/dirstate.py
with
39 additions
and
2 deletions
mercurial/dirstate.py
+
39
−
2
View file @
a0520226
...
...
@@ -127,8 +127,7 @@
@propertycache
def
_map
(
self
):
'''
Return the dirstate contents as a map from filename to
(state, mode, size, time).
'''
"""
Return the dirstate contents (see documentation for dirstatemap).
"""
self
.
_map
=
dirstatemap
(
self
.
_ui
,
self
.
_opener
,
self
.
_root
)
return
self
.
_map
...
...
@@ -1196,6 +1195,44 @@
self
.
_opener
.
unlink
(
backupname
)
class
dirstatemap
(
object
):
"""
Map encapsulating the dirstate
'
s contents.
The dirstate contains the following state:
- `identity` is the identity of the dirstate file, which can be used to
detect when changes have occurred to the dirstate file.
- `parents` is a pair containing the parents of the working copy. The
parents are updated by calling `setparents`.
- the state map maps filenames to tuples of (state, mode, size, mtime),
where state is a single character representing
'
normal
'
,
'
added
'
,
'
removed
'
, or
'
merged
'
. It is accessed by treating the dirstate as a
dict.
- `copymap` maps destination filenames to their source filename.
The dirstate also provides the following views onto the state:
- `nonnormalset` is a set of the filenames that have state other
than
'
normal
'
, or are normal but have an mtime of -1 (
'
normallookup
'
).
- `otherparentset` is a set of the filenames that are marked as coming
from the second parent when the dirstate is currently being merged.
- `dirs` is a set-like object containing all the directories that contain
files in the dirstate, excluding any files that are marked as removed.
- `filefoldmap` is a dict mapping normalized filenames to the denormalized
form that they appear as in the dirstate.
- `dirfoldmap` is a dict mapping normalized directory names to the
denormalized form that they appear as in the dirstate.
Once instantiated, the nonnormalset, otherparentset, dirs, filefoldmap and
dirfoldmap views must be maintained by the caller.
"""
def
__init__
(
self
,
ui
,
opener
,
root
):
self
.
_ui
=
ui
self
.
_opener
=
opener
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment