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