##// END OF EJS Templates
dirstate: add missing methods and kwargs to idirstate interface
av6 -
r50777:8c7895db default
parent child Browse files
Show More
@@ -1,216 +1,222 b''
1 1 import contextlib
2 2
3 3 from . import util as interfaceutil
4 4
5 5
6 6 class idirstate(interfaceutil.Interface):
7 7 def __init__(
8 8 opener,
9 9 ui,
10 10 root,
11 11 validate,
12 12 sparsematchfn,
13 13 nodeconstants,
14 14 use_dirstate_v2,
15 use_tracked_hint=False,
15 16 ):
16 17 """Create a new dirstate object.
17 18
18 19 opener is an open()-like callable that can be used to open the
19 20 dirstate file; root is the root of the directory tracked by
20 21 the dirstate.
21 22 """
22 23
23 24 # TODO: all these private methods and attributes should be made
24 25 # public or removed from the interface.
25 26 _ignore = interfaceutil.Attribute("""Matcher for ignored files.""")
26 27
27 28 def _ignorefiles():
28 29 """Return a list of files containing patterns to ignore."""
29 30
30 31 def _ignorefileandline(f):
31 32 """Given a file `f`, return the ignore file and line that ignores it."""
32 33
33 34 _checklink = interfaceutil.Attribute("""Callable for checking symlinks.""")
34 35 _checkexec = interfaceutil.Attribute("""Callable for checking exec bits.""")
35 36
36 37 @contextlib.contextmanager
37 38 def parentchange():
38 39 """Context manager for handling dirstate parents.
39 40
40 41 If an exception occurs in the scope of the context manager,
41 42 the incoherent dirstate won't be written when wlock is
42 43 released.
43 44 """
44 45
45 46 def pendingparentchange():
46 47 """Returns true if the dirstate is in the middle of a set of changes
47 48 that modify the dirstate parent.
48 49 """
49 50
50 51 def hasdir(d):
51 52 pass
52 53
53 54 def flagfunc(buildfallback):
54 55 """build a callable that returns flags associated with a filename
55 56
56 57 The information is extracted from three possible layers:
57 58 1. the file system if it supports the information
58 59 2. the "fallback" information stored in the dirstate if any
59 60 3. a more expensive mechanism inferring the flags from the parents.
60 61 """
61 62
62 63 def getcwd():
63 64 """Return the path from which a canonical path is calculated.
64 65
65 66 This path should be used to resolve file patterns or to convert
66 67 canonical paths back to file paths for display. It shouldn't be
67 68 used to get real file paths. Use vfs functions instead.
68 69 """
69 70
70 71 def pathto(f, cwd=None):
71 72 pass
72 73
73 74 def get_entry(path):
74 75 """return a DirstateItem for the associated path"""
75 76
76 77 def __contains__(key):
77 78 """Check if bytestring `key` is known to the dirstate."""
78 79
79 80 def __iter__():
80 81 """Iterate the dirstate's contained filenames as bytestrings."""
81 82
82 83 def items():
83 84 """Iterate the dirstate's entries as (filename, DirstateItem.
84 85
85 86 As usual, filename is a bytestring.
86 87 """
87 88
88 89 iteritems = items
89 90
90 91 def parents():
91 92 pass
92 93
93 94 def p1():
94 95 pass
95 96
96 97 def p2():
97 98 pass
98 99
99 100 def branch():
100 101 pass
101 102
102 103 def setparents(p1, p2=None):
103 104 """Set dirstate parents to p1 and p2.
104 105
105 106 When moving from two parents to one, "merged" entries a
106 107 adjusted to normal and previous copy records discarded and
107 108 returned by the call.
108 109
109 110 See localrepo.setparents()
110 111 """
111 112
112 113 def setbranch(branch):
113 114 pass
114 115
115 116 def invalidate():
116 117 """Causes the next access to reread the dirstate.
117 118
118 119 This is different from localrepo.invalidatedirstate() because it always
119 120 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
120 121 check whether the dirstate has changed before rereading it."""
121 122
122 123 def copy(source, dest):
123 124 """Mark dest as a copy of source. Unmark dest if source is None."""
124 125
125 126 def copied(file):
126 127 pass
127 128
128 129 def copies():
129 130 pass
130 131
131 132 def normalize(path, isknown=False, ignoremissing=False):
132 133 """
133 134 normalize the case of a pathname when on a casefolding filesystem
134 135
135 136 isknown specifies whether the filename came from walking the
136 137 disk, to avoid extra filesystem access.
137 138
138 139 If ignoremissing is True, missing path are returned
139 140 unchanged. Otherwise, we try harder to normalize possibly
140 141 existing path components.
141 142
142 143 The normalized case is determined based on the following precedence:
143 144
144 145 - version of name already stored in the dirstate
145 146 - version of name stored on disk
146 147 - version provided via command arguments
147 148 """
148 149
149 150 def clear():
150 151 pass
151 152
152 153 def rebuild(parent, allfiles, changedfiles=None):
153 154 pass
154 155
155 156 def identity():
156 157 """Return identity of dirstate itself to detect changing in storage
157 158
158 159 If identity of previous dirstate is equal to this, writing
159 160 changes based on the former dirstate out can keep consistency.
160 161 """
161 162
162 163 def write(tr):
163 164 pass
164 165
165 166 def addparentchangecallback(category, callback):
166 167 """add a callback to be called when the wd parents are changed
167 168
168 169 Callback will be called with the following arguments:
169 170 dirstate, (oldp1, oldp2), (newp1, newp2)
170 171
171 172 Category is a unique identifier to allow overwriting an old callback
172 173 with a newer callback.
173 174 """
174 175
175 176 def walk(match, subrepos, unknown, ignored, full=True):
176 177 """
177 178 Walk recursively through the directory tree, finding all files
178 179 matched by match.
179 180
180 181 If full is False, maybe skip some known-clean files.
181 182
182 183 Return a dict mapping filename to stat-like object (either
183 184 mercurial.osutil.stat instance or return value of os.stat()).
184 185
185 186 """
186 187
187 188 def status(match, subrepos, ignored, clean, unknown):
188 189 """Determine the status of the working copy relative to the
189 190 dirstate and return a pair of (unsure, status), where status is of type
190 191 scmutil.status and:
191 192
192 193 unsure:
193 194 files that might have been modified since the dirstate was
194 195 written, but need to be read to be sure (size is the same
195 196 but mtime differs)
196 197 status.modified:
197 198 files that have definitely been modified since the dirstate
198 199 was written (different size or mode)
199 200 status.clean:
200 201 files that have definitely not been modified since the
201 202 dirstate was written
202 203 """
203 204
204 205 def matches(match):
205 206 """
206 207 return files in the dirstate (in whatever state) filtered by match
207 208 """
208 209
209 210 def savebackup(tr, backupname):
210 211 '''Save current dirstate into backup file'''
211 212
212 213 def restorebackup(tr, backupname):
213 214 '''Restore dirstate by backup file'''
214 215
215 216 def clearbackup(tr, backupname):
216 217 '''Clear backup file'''
218
219 def verify(m1, m2, p1, narrow_matcher=None):
220 """
221 check the dirstate contents against the parent manifest and yield errors
222 """
General Comments 0
You need to be logged in to leave comments. Login now