##// END OF EJS Templates
repository: clarify role of imanifestlog...
Gregory Szorc -
r39276:2af6b2d8 default
parent child Browse files
Show More
@@ -1,1400 +1,1406
1 # repository.py - Interfaces and base classes for repositories and peers.
1 # repository.py - Interfaces and base classes for repositories and peers.
2 #
2 #
3 # Copyright 2017 Gregory Szorc <gregory.szorc@gmail.com>
3 # Copyright 2017 Gregory Szorc <gregory.szorc@gmail.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from .i18n import _
10 from .i18n import _
11 from . import (
11 from . import (
12 error,
12 error,
13 )
13 )
14 from .utils import (
14 from .utils import (
15 interfaceutil,
15 interfaceutil,
16 )
16 )
17
17
18 # When narrowing is finalized and no longer subject to format changes,
18 # When narrowing is finalized and no longer subject to format changes,
19 # we should move this to just "narrow" or similar.
19 # we should move this to just "narrow" or similar.
20 NARROW_REQUIREMENT = 'narrowhg-experimental'
20 NARROW_REQUIREMENT = 'narrowhg-experimental'
21
21
22 class ipeerconnection(interfaceutil.Interface):
22 class ipeerconnection(interfaceutil.Interface):
23 """Represents a "connection" to a repository.
23 """Represents a "connection" to a repository.
24
24
25 This is the base interface for representing a connection to a repository.
25 This is the base interface for representing a connection to a repository.
26 It holds basic properties and methods applicable to all peer types.
26 It holds basic properties and methods applicable to all peer types.
27
27
28 This is not a complete interface definition and should not be used
28 This is not a complete interface definition and should not be used
29 outside of this module.
29 outside of this module.
30 """
30 """
31 ui = interfaceutil.Attribute("""ui.ui instance""")
31 ui = interfaceutil.Attribute("""ui.ui instance""")
32
32
33 def url():
33 def url():
34 """Returns a URL string representing this peer.
34 """Returns a URL string representing this peer.
35
35
36 Currently, implementations expose the raw URL used to construct the
36 Currently, implementations expose the raw URL used to construct the
37 instance. It may contain credentials as part of the URL. The
37 instance. It may contain credentials as part of the URL. The
38 expectations of the value aren't well-defined and this could lead to
38 expectations of the value aren't well-defined and this could lead to
39 data leakage.
39 data leakage.
40
40
41 TODO audit/clean consumers and more clearly define the contents of this
41 TODO audit/clean consumers and more clearly define the contents of this
42 value.
42 value.
43 """
43 """
44
44
45 def local():
45 def local():
46 """Returns a local repository instance.
46 """Returns a local repository instance.
47
47
48 If the peer represents a local repository, returns an object that
48 If the peer represents a local repository, returns an object that
49 can be used to interface with it. Otherwise returns ``None``.
49 can be used to interface with it. Otherwise returns ``None``.
50 """
50 """
51
51
52 def peer():
52 def peer():
53 """Returns an object conforming to this interface.
53 """Returns an object conforming to this interface.
54
54
55 Most implementations will ``return self``.
55 Most implementations will ``return self``.
56 """
56 """
57
57
58 def canpush():
58 def canpush():
59 """Returns a boolean indicating if this peer can be pushed to."""
59 """Returns a boolean indicating if this peer can be pushed to."""
60
60
61 def close():
61 def close():
62 """Close the connection to this peer.
62 """Close the connection to this peer.
63
63
64 This is called when the peer will no longer be used. Resources
64 This is called when the peer will no longer be used. Resources
65 associated with the peer should be cleaned up.
65 associated with the peer should be cleaned up.
66 """
66 """
67
67
68 class ipeercapabilities(interfaceutil.Interface):
68 class ipeercapabilities(interfaceutil.Interface):
69 """Peer sub-interface related to capabilities."""
69 """Peer sub-interface related to capabilities."""
70
70
71 def capable(name):
71 def capable(name):
72 """Determine support for a named capability.
72 """Determine support for a named capability.
73
73
74 Returns ``False`` if capability not supported.
74 Returns ``False`` if capability not supported.
75
75
76 Returns ``True`` if boolean capability is supported. Returns a string
76 Returns ``True`` if boolean capability is supported. Returns a string
77 if capability support is non-boolean.
77 if capability support is non-boolean.
78
78
79 Capability strings may or may not map to wire protocol capabilities.
79 Capability strings may or may not map to wire protocol capabilities.
80 """
80 """
81
81
82 def requirecap(name, purpose):
82 def requirecap(name, purpose):
83 """Require a capability to be present.
83 """Require a capability to be present.
84
84
85 Raises a ``CapabilityError`` if the capability isn't present.
85 Raises a ``CapabilityError`` if the capability isn't present.
86 """
86 """
87
87
88 class ipeercommands(interfaceutil.Interface):
88 class ipeercommands(interfaceutil.Interface):
89 """Client-side interface for communicating over the wire protocol.
89 """Client-side interface for communicating over the wire protocol.
90
90
91 This interface is used as a gateway to the Mercurial wire protocol.
91 This interface is used as a gateway to the Mercurial wire protocol.
92 methods commonly call wire protocol commands of the same name.
92 methods commonly call wire protocol commands of the same name.
93 """
93 """
94
94
95 def branchmap():
95 def branchmap():
96 """Obtain heads in named branches.
96 """Obtain heads in named branches.
97
97
98 Returns a dict mapping branch name to an iterable of nodes that are
98 Returns a dict mapping branch name to an iterable of nodes that are
99 heads on that branch.
99 heads on that branch.
100 """
100 """
101
101
102 def capabilities():
102 def capabilities():
103 """Obtain capabilities of the peer.
103 """Obtain capabilities of the peer.
104
104
105 Returns a set of string capabilities.
105 Returns a set of string capabilities.
106 """
106 """
107
107
108 def clonebundles():
108 def clonebundles():
109 """Obtains the clone bundles manifest for the repo.
109 """Obtains the clone bundles manifest for the repo.
110
110
111 Returns the manifest as unparsed bytes.
111 Returns the manifest as unparsed bytes.
112 """
112 """
113
113
114 def debugwireargs(one, two, three=None, four=None, five=None):
114 def debugwireargs(one, two, three=None, four=None, five=None):
115 """Used to facilitate debugging of arguments passed over the wire."""
115 """Used to facilitate debugging of arguments passed over the wire."""
116
116
117 def getbundle(source, **kwargs):
117 def getbundle(source, **kwargs):
118 """Obtain remote repository data as a bundle.
118 """Obtain remote repository data as a bundle.
119
119
120 This command is how the bulk of repository data is transferred from
120 This command is how the bulk of repository data is transferred from
121 the peer to the local repository
121 the peer to the local repository
122
122
123 Returns a generator of bundle data.
123 Returns a generator of bundle data.
124 """
124 """
125
125
126 def heads():
126 def heads():
127 """Determine all known head revisions in the peer.
127 """Determine all known head revisions in the peer.
128
128
129 Returns an iterable of binary nodes.
129 Returns an iterable of binary nodes.
130 """
130 """
131
131
132 def known(nodes):
132 def known(nodes):
133 """Determine whether multiple nodes are known.
133 """Determine whether multiple nodes are known.
134
134
135 Accepts an iterable of nodes whose presence to check for.
135 Accepts an iterable of nodes whose presence to check for.
136
136
137 Returns an iterable of booleans indicating of the corresponding node
137 Returns an iterable of booleans indicating of the corresponding node
138 at that index is known to the peer.
138 at that index is known to the peer.
139 """
139 """
140
140
141 def listkeys(namespace):
141 def listkeys(namespace):
142 """Obtain all keys in a pushkey namespace.
142 """Obtain all keys in a pushkey namespace.
143
143
144 Returns an iterable of key names.
144 Returns an iterable of key names.
145 """
145 """
146
146
147 def lookup(key):
147 def lookup(key):
148 """Resolve a value to a known revision.
148 """Resolve a value to a known revision.
149
149
150 Returns a binary node of the resolved revision on success.
150 Returns a binary node of the resolved revision on success.
151 """
151 """
152
152
153 def pushkey(namespace, key, old, new):
153 def pushkey(namespace, key, old, new):
154 """Set a value using the ``pushkey`` protocol.
154 """Set a value using the ``pushkey`` protocol.
155
155
156 Arguments correspond to the pushkey namespace and key to operate on and
156 Arguments correspond to the pushkey namespace and key to operate on and
157 the old and new values for that key.
157 the old and new values for that key.
158
158
159 Returns a string with the peer result. The value inside varies by the
159 Returns a string with the peer result. The value inside varies by the
160 namespace.
160 namespace.
161 """
161 """
162
162
163 def stream_out():
163 def stream_out():
164 """Obtain streaming clone data.
164 """Obtain streaming clone data.
165
165
166 Successful result should be a generator of data chunks.
166 Successful result should be a generator of data chunks.
167 """
167 """
168
168
169 def unbundle(bundle, heads, url):
169 def unbundle(bundle, heads, url):
170 """Transfer repository data to the peer.
170 """Transfer repository data to the peer.
171
171
172 This is how the bulk of data during a push is transferred.
172 This is how the bulk of data during a push is transferred.
173
173
174 Returns the integer number of heads added to the peer.
174 Returns the integer number of heads added to the peer.
175 """
175 """
176
176
177 class ipeerlegacycommands(interfaceutil.Interface):
177 class ipeerlegacycommands(interfaceutil.Interface):
178 """Interface for implementing support for legacy wire protocol commands.
178 """Interface for implementing support for legacy wire protocol commands.
179
179
180 Wire protocol commands transition to legacy status when they are no longer
180 Wire protocol commands transition to legacy status when they are no longer
181 used by modern clients. To facilitate identifying which commands are
181 used by modern clients. To facilitate identifying which commands are
182 legacy, the interfaces are split.
182 legacy, the interfaces are split.
183 """
183 """
184
184
185 def between(pairs):
185 def between(pairs):
186 """Obtain nodes between pairs of nodes.
186 """Obtain nodes between pairs of nodes.
187
187
188 ``pairs`` is an iterable of node pairs.
188 ``pairs`` is an iterable of node pairs.
189
189
190 Returns an iterable of iterables of nodes corresponding to each
190 Returns an iterable of iterables of nodes corresponding to each
191 requested pair.
191 requested pair.
192 """
192 """
193
193
194 def branches(nodes):
194 def branches(nodes):
195 """Obtain ancestor changesets of specific nodes back to a branch point.
195 """Obtain ancestor changesets of specific nodes back to a branch point.
196
196
197 For each requested node, the peer finds the first ancestor node that is
197 For each requested node, the peer finds the first ancestor node that is
198 a DAG root or is a merge.
198 a DAG root or is a merge.
199
199
200 Returns an iterable of iterables with the resolved values for each node.
200 Returns an iterable of iterables with the resolved values for each node.
201 """
201 """
202
202
203 def changegroup(nodes, source):
203 def changegroup(nodes, source):
204 """Obtain a changegroup with data for descendants of specified nodes."""
204 """Obtain a changegroup with data for descendants of specified nodes."""
205
205
206 def changegroupsubset(bases, heads, source):
206 def changegroupsubset(bases, heads, source):
207 pass
207 pass
208
208
209 class ipeercommandexecutor(interfaceutil.Interface):
209 class ipeercommandexecutor(interfaceutil.Interface):
210 """Represents a mechanism to execute remote commands.
210 """Represents a mechanism to execute remote commands.
211
211
212 This is the primary interface for requesting that wire protocol commands
212 This is the primary interface for requesting that wire protocol commands
213 be executed. Instances of this interface are active in a context manager
213 be executed. Instances of this interface are active in a context manager
214 and have a well-defined lifetime. When the context manager exits, all
214 and have a well-defined lifetime. When the context manager exits, all
215 outstanding requests are waited on.
215 outstanding requests are waited on.
216 """
216 """
217
217
218 def callcommand(name, args):
218 def callcommand(name, args):
219 """Request that a named command be executed.
219 """Request that a named command be executed.
220
220
221 Receives the command name and a dictionary of command arguments.
221 Receives the command name and a dictionary of command arguments.
222
222
223 Returns a ``concurrent.futures.Future`` that will resolve to the
223 Returns a ``concurrent.futures.Future`` that will resolve to the
224 result of that command request. That exact value is left up to
224 result of that command request. That exact value is left up to
225 the implementation and possibly varies by command.
225 the implementation and possibly varies by command.
226
226
227 Not all commands can coexist with other commands in an executor
227 Not all commands can coexist with other commands in an executor
228 instance: it depends on the underlying wire protocol transport being
228 instance: it depends on the underlying wire protocol transport being
229 used and the command itself.
229 used and the command itself.
230
230
231 Implementations MAY call ``sendcommands()`` automatically if the
231 Implementations MAY call ``sendcommands()`` automatically if the
232 requested command can not coexist with other commands in this executor.
232 requested command can not coexist with other commands in this executor.
233
233
234 Implementations MAY call ``sendcommands()`` automatically when the
234 Implementations MAY call ``sendcommands()`` automatically when the
235 future's ``result()`` is called. So, consumers using multiple
235 future's ``result()`` is called. So, consumers using multiple
236 commands with an executor MUST ensure that ``result()`` is not called
236 commands with an executor MUST ensure that ``result()`` is not called
237 until all command requests have been issued.
237 until all command requests have been issued.
238 """
238 """
239
239
240 def sendcommands():
240 def sendcommands():
241 """Trigger submission of queued command requests.
241 """Trigger submission of queued command requests.
242
242
243 Not all transports submit commands as soon as they are requested to
243 Not all transports submit commands as soon as they are requested to
244 run. When called, this method forces queued command requests to be
244 run. When called, this method forces queued command requests to be
245 issued. It will no-op if all commands have already been sent.
245 issued. It will no-op if all commands have already been sent.
246
246
247 When called, no more new commands may be issued with this executor.
247 When called, no more new commands may be issued with this executor.
248 """
248 """
249
249
250 def close():
250 def close():
251 """Signal that this command request is finished.
251 """Signal that this command request is finished.
252
252
253 When called, no more new commands may be issued. All outstanding
253 When called, no more new commands may be issued. All outstanding
254 commands that have previously been issued are waited on before
254 commands that have previously been issued are waited on before
255 returning. This not only includes waiting for the futures to resolve,
255 returning. This not only includes waiting for the futures to resolve,
256 but also waiting for all response data to arrive. In other words,
256 but also waiting for all response data to arrive. In other words,
257 calling this waits for all on-wire state for issued command requests
257 calling this waits for all on-wire state for issued command requests
258 to finish.
258 to finish.
259
259
260 When used as a context manager, this method is called when exiting the
260 When used as a context manager, this method is called when exiting the
261 context manager.
261 context manager.
262
262
263 This method may call ``sendcommands()`` if there are buffered commands.
263 This method may call ``sendcommands()`` if there are buffered commands.
264 """
264 """
265
265
266 class ipeerrequests(interfaceutil.Interface):
266 class ipeerrequests(interfaceutil.Interface):
267 """Interface for executing commands on a peer."""
267 """Interface for executing commands on a peer."""
268
268
269 def commandexecutor():
269 def commandexecutor():
270 """A context manager that resolves to an ipeercommandexecutor.
270 """A context manager that resolves to an ipeercommandexecutor.
271
271
272 The object this resolves to can be used to issue command requests
272 The object this resolves to can be used to issue command requests
273 to the peer.
273 to the peer.
274
274
275 Callers should call its ``callcommand`` method to issue command
275 Callers should call its ``callcommand`` method to issue command
276 requests.
276 requests.
277
277
278 A new executor should be obtained for each distinct set of commands
278 A new executor should be obtained for each distinct set of commands
279 (possibly just a single command) that the consumer wants to execute
279 (possibly just a single command) that the consumer wants to execute
280 as part of a single operation or round trip. This is because some
280 as part of a single operation or round trip. This is because some
281 peers are half-duplex and/or don't support persistent connections.
281 peers are half-duplex and/or don't support persistent connections.
282 e.g. in the case of HTTP peers, commands sent to an executor represent
282 e.g. in the case of HTTP peers, commands sent to an executor represent
283 a single HTTP request. While some peers may support multiple command
283 a single HTTP request. While some peers may support multiple command
284 sends over the wire per executor, consumers need to code to the least
284 sends over the wire per executor, consumers need to code to the least
285 capable peer. So it should be assumed that command executors buffer
285 capable peer. So it should be assumed that command executors buffer
286 called commands until they are told to send them and that each
286 called commands until they are told to send them and that each
287 command executor could result in a new connection or wire-level request
287 command executor could result in a new connection or wire-level request
288 being issued.
288 being issued.
289 """
289 """
290
290
291 class ipeerbase(ipeerconnection, ipeercapabilities, ipeerrequests):
291 class ipeerbase(ipeerconnection, ipeercapabilities, ipeerrequests):
292 """Unified interface for peer repositories.
292 """Unified interface for peer repositories.
293
293
294 All peer instances must conform to this interface.
294 All peer instances must conform to this interface.
295 """
295 """
296
296
297 @interfaceutil.implementer(ipeerbase)
297 @interfaceutil.implementer(ipeerbase)
298 class peer(object):
298 class peer(object):
299 """Base class for peer repositories."""
299 """Base class for peer repositories."""
300
300
301 def capable(self, name):
301 def capable(self, name):
302 caps = self.capabilities()
302 caps = self.capabilities()
303 if name in caps:
303 if name in caps:
304 return True
304 return True
305
305
306 name = '%s=' % name
306 name = '%s=' % name
307 for cap in caps:
307 for cap in caps:
308 if cap.startswith(name):
308 if cap.startswith(name):
309 return cap[len(name):]
309 return cap[len(name):]
310
310
311 return False
311 return False
312
312
313 def requirecap(self, name, purpose):
313 def requirecap(self, name, purpose):
314 if self.capable(name):
314 if self.capable(name):
315 return
315 return
316
316
317 raise error.CapabilityError(
317 raise error.CapabilityError(
318 _('cannot %s; remote repository does not support the %r '
318 _('cannot %s; remote repository does not support the %r '
319 'capability') % (purpose, name))
319 'capability') % (purpose, name))
320
320
321 class irevisiondelta(interfaceutil.Interface):
321 class irevisiondelta(interfaceutil.Interface):
322 """Represents a delta between one revision and another.
322 """Represents a delta between one revision and another.
323
323
324 Instances convey enough information to allow a revision to be exchanged
324 Instances convey enough information to allow a revision to be exchanged
325 with another repository.
325 with another repository.
326
326
327 Instances represent the fulltext revision data or a delta against
327 Instances represent the fulltext revision data or a delta against
328 another revision. Therefore the ``revision`` and ``delta`` attributes
328 another revision. Therefore the ``revision`` and ``delta`` attributes
329 are mutually exclusive.
329 are mutually exclusive.
330
330
331 Typically used for changegroup generation.
331 Typically used for changegroup generation.
332 """
332 """
333
333
334 node = interfaceutil.Attribute(
334 node = interfaceutil.Attribute(
335 """20 byte node of this revision.""")
335 """20 byte node of this revision.""")
336
336
337 p1node = interfaceutil.Attribute(
337 p1node = interfaceutil.Attribute(
338 """20 byte node of 1st parent of this revision.""")
338 """20 byte node of 1st parent of this revision.""")
339
339
340 p2node = interfaceutil.Attribute(
340 p2node = interfaceutil.Attribute(
341 """20 byte node of 2nd parent of this revision.""")
341 """20 byte node of 2nd parent of this revision.""")
342
342
343 linknode = interfaceutil.Attribute(
343 linknode = interfaceutil.Attribute(
344 """20 byte node of the changelog revision this node is linked to.""")
344 """20 byte node of the changelog revision this node is linked to.""")
345
345
346 flags = interfaceutil.Attribute(
346 flags = interfaceutil.Attribute(
347 """2 bytes of integer flags that apply to this revision.""")
347 """2 bytes of integer flags that apply to this revision.""")
348
348
349 basenode = interfaceutil.Attribute(
349 basenode = interfaceutil.Attribute(
350 """20 byte node of the revision this data is a delta against.
350 """20 byte node of the revision this data is a delta against.
351
351
352 ``nullid`` indicates that the revision is a full revision and not
352 ``nullid`` indicates that the revision is a full revision and not
353 a delta.
353 a delta.
354 """)
354 """)
355
355
356 baserevisionsize = interfaceutil.Attribute(
356 baserevisionsize = interfaceutil.Attribute(
357 """Size of base revision this delta is against.
357 """Size of base revision this delta is against.
358
358
359 May be ``None`` if ``basenode`` is ``nullid``.
359 May be ``None`` if ``basenode`` is ``nullid``.
360 """)
360 """)
361
361
362 revision = interfaceutil.Attribute(
362 revision = interfaceutil.Attribute(
363 """Raw fulltext of revision data for this node.""")
363 """Raw fulltext of revision data for this node.""")
364
364
365 delta = interfaceutil.Attribute(
365 delta = interfaceutil.Attribute(
366 """Delta between ``basenode`` and ``node``.
366 """Delta between ``basenode`` and ``node``.
367
367
368 Stored in the bdiff delta format.
368 Stored in the bdiff delta format.
369 """)
369 """)
370
370
371 class irevisiondeltarequest(interfaceutil.Interface):
371 class irevisiondeltarequest(interfaceutil.Interface):
372 """Represents a request to generate an ``irevisiondelta``."""
372 """Represents a request to generate an ``irevisiondelta``."""
373
373
374 node = interfaceutil.Attribute(
374 node = interfaceutil.Attribute(
375 """20 byte node of revision being requested.""")
375 """20 byte node of revision being requested.""")
376
376
377 p1node = interfaceutil.Attribute(
377 p1node = interfaceutil.Attribute(
378 """20 byte node of 1st parent of revision.""")
378 """20 byte node of 1st parent of revision.""")
379
379
380 p2node = interfaceutil.Attribute(
380 p2node = interfaceutil.Attribute(
381 """20 byte node of 2nd parent of revision.""")
381 """20 byte node of 2nd parent of revision.""")
382
382
383 linknode = interfaceutil.Attribute(
383 linknode = interfaceutil.Attribute(
384 """20 byte node to store in ``linknode`` attribute.""")
384 """20 byte node to store in ``linknode`` attribute.""")
385
385
386 basenode = interfaceutil.Attribute(
386 basenode = interfaceutil.Attribute(
387 """Base revision that delta should be generated against.
387 """Base revision that delta should be generated against.
388
388
389 If ``nullid``, the derived ``irevisiondelta`` should have its
389 If ``nullid``, the derived ``irevisiondelta`` should have its
390 ``revision`` field populated and no delta should be generated.
390 ``revision`` field populated and no delta should be generated.
391
391
392 If ``None``, the delta may be generated against any revision that
392 If ``None``, the delta may be generated against any revision that
393 is an ancestor of this revision. Or a full revision may be used.
393 is an ancestor of this revision. Or a full revision may be used.
394
394
395 If any other value, the delta should be produced against that
395 If any other value, the delta should be produced against that
396 revision.
396 revision.
397 """)
397 """)
398
398
399 ellipsis = interfaceutil.Attribute(
399 ellipsis = interfaceutil.Attribute(
400 """Boolean on whether the ellipsis flag should be set.""")
400 """Boolean on whether the ellipsis flag should be set.""")
401
401
402 class ifilerevisionssequence(interfaceutil.Interface):
402 class ifilerevisionssequence(interfaceutil.Interface):
403 """Contains index data for all revisions of a file.
403 """Contains index data for all revisions of a file.
404
404
405 Types implementing this behave like lists of tuples. The index
405 Types implementing this behave like lists of tuples. The index
406 in the list corresponds to the revision number. The values contain
406 in the list corresponds to the revision number. The values contain
407 index metadata.
407 index metadata.
408
408
409 The *null* revision (revision number -1) is always the last item
409 The *null* revision (revision number -1) is always the last item
410 in the index.
410 in the index.
411 """
411 """
412
412
413 def __len__():
413 def __len__():
414 """The total number of revisions."""
414 """The total number of revisions."""
415
415
416 def __getitem__(rev):
416 def __getitem__(rev):
417 """Returns the object having a specific revision number.
417 """Returns the object having a specific revision number.
418
418
419 Returns an 8-tuple with the following fields:
419 Returns an 8-tuple with the following fields:
420
420
421 offset+flags
421 offset+flags
422 Contains the offset and flags for the revision. 64-bit unsigned
422 Contains the offset and flags for the revision. 64-bit unsigned
423 integer where first 6 bytes are the offset and the next 2 bytes
423 integer where first 6 bytes are the offset and the next 2 bytes
424 are flags. The offset can be 0 if it is not used by the store.
424 are flags. The offset can be 0 if it is not used by the store.
425 compressed size
425 compressed size
426 Size of the revision data in the store. It can be 0 if it isn't
426 Size of the revision data in the store. It can be 0 if it isn't
427 needed by the store.
427 needed by the store.
428 uncompressed size
428 uncompressed size
429 Fulltext size. It can be 0 if it isn't needed by the store.
429 Fulltext size. It can be 0 if it isn't needed by the store.
430 base revision
430 base revision
431 Revision number of revision the delta for storage is encoded
431 Revision number of revision the delta for storage is encoded
432 against. -1 indicates not encoded against a base revision.
432 against. -1 indicates not encoded against a base revision.
433 link revision
433 link revision
434 Revision number of changelog revision this entry is related to.
434 Revision number of changelog revision this entry is related to.
435 p1 revision
435 p1 revision
436 Revision number of 1st parent. -1 if no 1st parent.
436 Revision number of 1st parent. -1 if no 1st parent.
437 p2 revision
437 p2 revision
438 Revision number of 2nd parent. -1 if no 1st parent.
438 Revision number of 2nd parent. -1 if no 1st parent.
439 node
439 node
440 Binary node value for this revision number.
440 Binary node value for this revision number.
441
441
442 Negative values should index off the end of the sequence. ``-1``
442 Negative values should index off the end of the sequence. ``-1``
443 should return the null revision. ``-2`` should return the most
443 should return the null revision. ``-2`` should return the most
444 recent revision.
444 recent revision.
445 """
445 """
446
446
447 def __contains__(rev):
447 def __contains__(rev):
448 """Whether a revision number exists."""
448 """Whether a revision number exists."""
449
449
450 def insert(self, i, entry):
450 def insert(self, i, entry):
451 """Add an item to the index at specific revision."""
451 """Add an item to the index at specific revision."""
452
452
453 class ifileindex(interfaceutil.Interface):
453 class ifileindex(interfaceutil.Interface):
454 """Storage interface for index data of a single file.
454 """Storage interface for index data of a single file.
455
455
456 File storage data is divided into index metadata and data storage.
456 File storage data is divided into index metadata and data storage.
457 This interface defines the index portion of the interface.
457 This interface defines the index portion of the interface.
458
458
459 The index logically consists of:
459 The index logically consists of:
460
460
461 * A mapping between revision numbers and nodes.
461 * A mapping between revision numbers and nodes.
462 * DAG data (storing and querying the relationship between nodes).
462 * DAG data (storing and querying the relationship between nodes).
463 * Metadata to facilitate storage.
463 * Metadata to facilitate storage.
464 """
464 """
465 index = interfaceutil.Attribute(
465 index = interfaceutil.Attribute(
466 """An ``ifilerevisionssequence`` instance.""")
466 """An ``ifilerevisionssequence`` instance.""")
467
467
468 def __len__():
468 def __len__():
469 """Obtain the number of revisions stored for this file."""
469 """Obtain the number of revisions stored for this file."""
470
470
471 def __iter__():
471 def __iter__():
472 """Iterate over revision numbers for this file."""
472 """Iterate over revision numbers for this file."""
473
473
474 def revs(start=0, stop=None):
474 def revs(start=0, stop=None):
475 """Iterate over revision numbers for this file, with control."""
475 """Iterate over revision numbers for this file, with control."""
476
476
477 def parents(node):
477 def parents(node):
478 """Returns a 2-tuple of parent nodes for a revision.
478 """Returns a 2-tuple of parent nodes for a revision.
479
479
480 Values will be ``nullid`` if the parent is empty.
480 Values will be ``nullid`` if the parent is empty.
481 """
481 """
482
482
483 def parentrevs(rev):
483 def parentrevs(rev):
484 """Like parents() but operates on revision numbers."""
484 """Like parents() but operates on revision numbers."""
485
485
486 def rev(node):
486 def rev(node):
487 """Obtain the revision number given a node.
487 """Obtain the revision number given a node.
488
488
489 Raises ``error.LookupError`` if the node is not known.
489 Raises ``error.LookupError`` if the node is not known.
490 """
490 """
491
491
492 def node(rev):
492 def node(rev):
493 """Obtain the node value given a revision number.
493 """Obtain the node value given a revision number.
494
494
495 Raises ``IndexError`` if the node is not known.
495 Raises ``IndexError`` if the node is not known.
496 """
496 """
497
497
498 def lookup(node):
498 def lookup(node):
499 """Attempt to resolve a value to a node.
499 """Attempt to resolve a value to a node.
500
500
501 Value can be a binary node, hex node, revision number, or a string
501 Value can be a binary node, hex node, revision number, or a string
502 that can be converted to an integer.
502 that can be converted to an integer.
503
503
504 Raises ``error.LookupError`` if a node could not be resolved.
504 Raises ``error.LookupError`` if a node could not be resolved.
505 """
505 """
506
506
507 def linkrev(rev):
507 def linkrev(rev):
508 """Obtain the changeset revision number a revision is linked to."""
508 """Obtain the changeset revision number a revision is linked to."""
509
509
510 def flags(rev):
510 def flags(rev):
511 """Obtain flags used to affect storage of a revision."""
511 """Obtain flags used to affect storage of a revision."""
512
512
513 def iscensored(rev):
513 def iscensored(rev):
514 """Return whether a revision's content has been censored."""
514 """Return whether a revision's content has been censored."""
515
515
516 def commonancestorsheads(node1, node2):
516 def commonancestorsheads(node1, node2):
517 """Obtain an iterable of nodes containing heads of common ancestors.
517 """Obtain an iterable of nodes containing heads of common ancestors.
518
518
519 See ``ancestor.commonancestorsheads()``.
519 See ``ancestor.commonancestorsheads()``.
520 """
520 """
521
521
522 def descendants(revs):
522 def descendants(revs):
523 """Obtain descendant revision numbers for a set of revision numbers.
523 """Obtain descendant revision numbers for a set of revision numbers.
524
524
525 If ``nullrev`` is in the set, this is equivalent to ``revs()``.
525 If ``nullrev`` is in the set, this is equivalent to ``revs()``.
526 """
526 """
527
527
528 def headrevs():
528 def headrevs():
529 """Obtain a list of revision numbers that are DAG heads.
529 """Obtain a list of revision numbers that are DAG heads.
530
530
531 The list is sorted oldest to newest.
531 The list is sorted oldest to newest.
532
532
533 TODO determine if sorting is required.
533 TODO determine if sorting is required.
534 """
534 """
535
535
536 def heads(start=None, stop=None):
536 def heads(start=None, stop=None):
537 """Obtain a list of nodes that are DAG heads, with control.
537 """Obtain a list of nodes that are DAG heads, with control.
538
538
539 The set of revisions examined can be limited by specifying
539 The set of revisions examined can be limited by specifying
540 ``start`` and ``stop``. ``start`` is a node. ``stop`` is an
540 ``start`` and ``stop``. ``start`` is a node. ``stop`` is an
541 iterable of nodes. DAG traversal starts at earlier revision
541 iterable of nodes. DAG traversal starts at earlier revision
542 ``start`` and iterates forward until any node in ``stop`` is
542 ``start`` and iterates forward until any node in ``stop`` is
543 encountered.
543 encountered.
544 """
544 """
545
545
546 def children(node):
546 def children(node):
547 """Obtain nodes that are children of a node.
547 """Obtain nodes that are children of a node.
548
548
549 Returns a list of nodes.
549 Returns a list of nodes.
550 """
550 """
551
551
552 def deltaparent(rev):
552 def deltaparent(rev):
553 """"Return the revision that is a suitable parent to delta against."""
553 """"Return the revision that is a suitable parent to delta against."""
554
554
555 class ifiledata(interfaceutil.Interface):
555 class ifiledata(interfaceutil.Interface):
556 """Storage interface for data storage of a specific file.
556 """Storage interface for data storage of a specific file.
557
557
558 This complements ``ifileindex`` and provides an interface for accessing
558 This complements ``ifileindex`` and provides an interface for accessing
559 data for a tracked file.
559 data for a tracked file.
560 """
560 """
561 def rawsize(rev):
561 def rawsize(rev):
562 """The size of the fulltext data for a revision as stored."""
562 """The size of the fulltext data for a revision as stored."""
563
563
564 def size(rev):
564 def size(rev):
565 """Obtain the fulltext size of file data.
565 """Obtain the fulltext size of file data.
566
566
567 Any metadata is excluded from size measurements. Use ``rawsize()`` if
567 Any metadata is excluded from size measurements. Use ``rawsize()`` if
568 metadata size is important.
568 metadata size is important.
569 """
569 """
570
570
571 def checkhash(fulltext, node, p1=None, p2=None, rev=None):
571 def checkhash(fulltext, node, p1=None, p2=None, rev=None):
572 """Validate the stored hash of a given fulltext and node.
572 """Validate the stored hash of a given fulltext and node.
573
573
574 Raises ``error.RevlogError`` is hash validation fails.
574 Raises ``error.RevlogError`` is hash validation fails.
575 """
575 """
576
576
577 def revision(node, raw=False):
577 def revision(node, raw=False):
578 """"Obtain fulltext data for a node.
578 """"Obtain fulltext data for a node.
579
579
580 By default, any storage transformations are applied before the data
580 By default, any storage transformations are applied before the data
581 is returned. If ``raw`` is True, non-raw storage transformations
581 is returned. If ``raw`` is True, non-raw storage transformations
582 are not applied.
582 are not applied.
583
583
584 The fulltext data may contain a header containing metadata. Most
584 The fulltext data may contain a header containing metadata. Most
585 consumers should use ``read()`` to obtain the actual file data.
585 consumers should use ``read()`` to obtain the actual file data.
586 """
586 """
587
587
588 def read(node):
588 def read(node):
589 """Resolve file fulltext data.
589 """Resolve file fulltext data.
590
590
591 This is similar to ``revision()`` except any metadata in the data
591 This is similar to ``revision()`` except any metadata in the data
592 headers is stripped.
592 headers is stripped.
593 """
593 """
594
594
595 def renamed(node):
595 def renamed(node):
596 """Obtain copy metadata for a node.
596 """Obtain copy metadata for a node.
597
597
598 Returns ``False`` if no copy metadata is stored or a 2-tuple of
598 Returns ``False`` if no copy metadata is stored or a 2-tuple of
599 (path, node) from which this revision was copied.
599 (path, node) from which this revision was copied.
600 """
600 """
601
601
602 def cmp(node, fulltext):
602 def cmp(node, fulltext):
603 """Compare fulltext to another revision.
603 """Compare fulltext to another revision.
604
604
605 Returns True if the fulltext is different from what is stored.
605 Returns True if the fulltext is different from what is stored.
606
606
607 This takes copy metadata into account.
607 This takes copy metadata into account.
608
608
609 TODO better document the copy metadata and censoring logic.
609 TODO better document the copy metadata and censoring logic.
610 """
610 """
611
611
612 def revdiff(rev1, rev2):
612 def revdiff(rev1, rev2):
613 """Obtain a delta between two revision numbers.
613 """Obtain a delta between two revision numbers.
614
614
615 Operates on raw data in the store (``revision(node, raw=True)``).
615 Operates on raw data in the store (``revision(node, raw=True)``).
616
616
617 The returned data is the result of ``bdiff.bdiff`` on the raw
617 The returned data is the result of ``bdiff.bdiff`` on the raw
618 revision data.
618 revision data.
619 """
619 """
620
620
621 def emitrevisiondeltas(requests):
621 def emitrevisiondeltas(requests):
622 """Produce ``irevisiondelta`` from ``irevisiondeltarequest``s.
622 """Produce ``irevisiondelta`` from ``irevisiondeltarequest``s.
623
623
624 Given an iterable of objects conforming to the ``irevisiondeltarequest``
624 Given an iterable of objects conforming to the ``irevisiondeltarequest``
625 interface, emits objects conforming to the ``irevisiondelta``
625 interface, emits objects conforming to the ``irevisiondelta``
626 interface.
626 interface.
627
627
628 This method is a generator.
628 This method is a generator.
629
629
630 ``irevisiondelta`` should be emitted in the same order of
630 ``irevisiondelta`` should be emitted in the same order of
631 ``irevisiondeltarequest`` that was passed in.
631 ``irevisiondeltarequest`` that was passed in.
632
632
633 The emitted objects MUST conform by the results of
633 The emitted objects MUST conform by the results of
634 ``irevisiondeltarequest``. Namely, they must respect any requests
634 ``irevisiondeltarequest``. Namely, they must respect any requests
635 for building a delta from a specific ``basenode`` if defined.
635 for building a delta from a specific ``basenode`` if defined.
636
636
637 When sending deltas, implementations must take into account whether
637 When sending deltas, implementations must take into account whether
638 the client has the base delta before encoding a delta against that
638 the client has the base delta before encoding a delta against that
639 revision. A revision encountered previously in ``requests`` is
639 revision. A revision encountered previously in ``requests`` is
640 always a suitable base revision. An example of a bad delta is a delta
640 always a suitable base revision. An example of a bad delta is a delta
641 against a non-ancestor revision. Another example of a bad delta is a
641 against a non-ancestor revision. Another example of a bad delta is a
642 delta against a censored revision.
642 delta against a censored revision.
643 """
643 """
644
644
645 class ifilemutation(interfaceutil.Interface):
645 class ifilemutation(interfaceutil.Interface):
646 """Storage interface for mutation events of a tracked file."""
646 """Storage interface for mutation events of a tracked file."""
647
647
648 def add(filedata, meta, transaction, linkrev, p1, p2):
648 def add(filedata, meta, transaction, linkrev, p1, p2):
649 """Add a new revision to the store.
649 """Add a new revision to the store.
650
650
651 Takes file data, dictionary of metadata, a transaction, linkrev,
651 Takes file data, dictionary of metadata, a transaction, linkrev,
652 and parent nodes.
652 and parent nodes.
653
653
654 Returns the node that was added.
654 Returns the node that was added.
655
655
656 May no-op if a revision matching the supplied data is already stored.
656 May no-op if a revision matching the supplied data is already stored.
657 """
657 """
658
658
659 def addrevision(revisiondata, transaction, linkrev, p1, p2, node=None,
659 def addrevision(revisiondata, transaction, linkrev, p1, p2, node=None,
660 flags=0, cachedelta=None):
660 flags=0, cachedelta=None):
661 """Add a new revision to the store.
661 """Add a new revision to the store.
662
662
663 This is similar to ``add()`` except it operates at a lower level.
663 This is similar to ``add()`` except it operates at a lower level.
664
664
665 The data passed in already contains a metadata header, if any.
665 The data passed in already contains a metadata header, if any.
666
666
667 ``node`` and ``flags`` can be used to define the expected node and
667 ``node`` and ``flags`` can be used to define the expected node and
668 the flags to use with storage.
668 the flags to use with storage.
669
669
670 ``add()`` is usually called when adding files from e.g. the working
670 ``add()`` is usually called when adding files from e.g. the working
671 directory. ``addrevision()`` is often called by ``add()`` and for
671 directory. ``addrevision()`` is often called by ``add()`` and for
672 scenarios where revision data has already been computed, such as when
672 scenarios where revision data has already been computed, such as when
673 applying raw data from a peer repo.
673 applying raw data from a peer repo.
674 """
674 """
675
675
676 def addgroup(deltas, linkmapper, transaction, addrevisioncb=None):
676 def addgroup(deltas, linkmapper, transaction, addrevisioncb=None):
677 """Process a series of deltas for storage.
677 """Process a series of deltas for storage.
678
678
679 ``deltas`` is an iterable of 7-tuples of
679 ``deltas`` is an iterable of 7-tuples of
680 (node, p1, p2, linknode, deltabase, delta, flags) defining revisions
680 (node, p1, p2, linknode, deltabase, delta, flags) defining revisions
681 to add.
681 to add.
682
682
683 The ``delta`` field contains ``mpatch`` data to apply to a base
683 The ``delta`` field contains ``mpatch`` data to apply to a base
684 revision, identified by ``deltabase``. The base node can be
684 revision, identified by ``deltabase``. The base node can be
685 ``nullid``, in which case the header from the delta can be ignored
685 ``nullid``, in which case the header from the delta can be ignored
686 and the delta used as the fulltext.
686 and the delta used as the fulltext.
687
687
688 ``addrevisioncb`` should be called for each node as it is committed.
688 ``addrevisioncb`` should be called for each node as it is committed.
689
689
690 Returns a list of nodes that were processed. A node will be in the list
690 Returns a list of nodes that were processed. A node will be in the list
691 even if it existed in the store previously.
691 even if it existed in the store previously.
692 """
692 """
693
693
694 def getstrippoint(minlink):
694 def getstrippoint(minlink):
695 """Find the minimum revision that must be stripped to strip a linkrev.
695 """Find the minimum revision that must be stripped to strip a linkrev.
696
696
697 Returns a 2-tuple containing the minimum revision number and a set
697 Returns a 2-tuple containing the minimum revision number and a set
698 of all revisions numbers that would be broken by this strip.
698 of all revisions numbers that would be broken by this strip.
699
699
700 TODO this is highly revlog centric and should be abstracted into
700 TODO this is highly revlog centric and should be abstracted into
701 a higher-level deletion API. ``repair.strip()`` relies on this.
701 a higher-level deletion API. ``repair.strip()`` relies on this.
702 """
702 """
703
703
704 def strip(minlink, transaction):
704 def strip(minlink, transaction):
705 """Remove storage of items starting at a linkrev.
705 """Remove storage of items starting at a linkrev.
706
706
707 This uses ``getstrippoint()`` to determine the first node to remove.
707 This uses ``getstrippoint()`` to determine the first node to remove.
708 Then it effectively truncates storage for all revisions after that.
708 Then it effectively truncates storage for all revisions after that.
709
709
710 TODO this is highly revlog centric and should be abstracted into a
710 TODO this is highly revlog centric and should be abstracted into a
711 higher-level deletion API.
711 higher-level deletion API.
712 """
712 """
713
713
714 class ifilestorage(ifileindex, ifiledata, ifilemutation):
714 class ifilestorage(ifileindex, ifiledata, ifilemutation):
715 """Complete storage interface for a single tracked file."""
715 """Complete storage interface for a single tracked file."""
716
716
717 version = interfaceutil.Attribute(
717 version = interfaceutil.Attribute(
718 """Version number of storage.
718 """Version number of storage.
719
719
720 TODO this feels revlog centric and could likely be removed.
720 TODO this feels revlog centric and could likely be removed.
721 """)
721 """)
722
722
723 _generaldelta = interfaceutil.Attribute(
723 _generaldelta = interfaceutil.Attribute(
724 """Whether deltas can be against any parent revision.
724 """Whether deltas can be against any parent revision.
725
725
726 TODO this is used by changegroup code and it could probably be
726 TODO this is used by changegroup code and it could probably be
727 folded into another API.
727 folded into another API.
728 """)
728 """)
729
729
730 def files():
730 def files():
731 """Obtain paths that are backing storage for this file.
731 """Obtain paths that are backing storage for this file.
732
732
733 TODO this is used heavily by verify code and there should probably
733 TODO this is used heavily by verify code and there should probably
734 be a better API for that.
734 be a better API for that.
735 """
735 """
736
736
737 def checksize():
737 def checksize():
738 """Obtain the expected sizes of backing files.
738 """Obtain the expected sizes of backing files.
739
739
740 TODO this is used by verify and it should not be part of the interface.
740 TODO this is used by verify and it should not be part of the interface.
741 """
741 """
742
742
743 class idirs(interfaceutil.Interface):
743 class idirs(interfaceutil.Interface):
744 """Interface representing a collection of directories from paths.
744 """Interface representing a collection of directories from paths.
745
745
746 This interface is essentially a derived data structure representing
746 This interface is essentially a derived data structure representing
747 directories from a collection of paths.
747 directories from a collection of paths.
748 """
748 """
749
749
750 def addpath(path):
750 def addpath(path):
751 """Add a path to the collection.
751 """Add a path to the collection.
752
752
753 All directories in the path will be added to the collection.
753 All directories in the path will be added to the collection.
754 """
754 """
755
755
756 def delpath(path):
756 def delpath(path):
757 """Remove a path from the collection.
757 """Remove a path from the collection.
758
758
759 If the removal was the last path in a particular directory, the
759 If the removal was the last path in a particular directory, the
760 directory is removed from the collection.
760 directory is removed from the collection.
761 """
761 """
762
762
763 def __iter__():
763 def __iter__():
764 """Iterate over the directories in this collection of paths."""
764 """Iterate over the directories in this collection of paths."""
765
765
766 def __contains__(path):
766 def __contains__(path):
767 """Whether a specific directory is in this collection."""
767 """Whether a specific directory is in this collection."""
768
768
769 class imanifestdict(interfaceutil.Interface):
769 class imanifestdict(interfaceutil.Interface):
770 """Interface representing a manifest data structure.
770 """Interface representing a manifest data structure.
771
771
772 A manifest is effectively a dict mapping paths to entries. Each entry
772 A manifest is effectively a dict mapping paths to entries. Each entry
773 consists of a binary node and extra flags affecting that entry.
773 consists of a binary node and extra flags affecting that entry.
774 """
774 """
775
775
776 def __getitem__(path):
776 def __getitem__(path):
777 """Returns the binary node value for a path in the manifest.
777 """Returns the binary node value for a path in the manifest.
778
778
779 Raises ``KeyError`` if the path does not exist in the manifest.
779 Raises ``KeyError`` if the path does not exist in the manifest.
780
780
781 Equivalent to ``self.find(path)[0]``.
781 Equivalent to ``self.find(path)[0]``.
782 """
782 """
783
783
784 def find(path):
784 def find(path):
785 """Returns the entry for a path in the manifest.
785 """Returns the entry for a path in the manifest.
786
786
787 Returns a 2-tuple of (node, flags).
787 Returns a 2-tuple of (node, flags).
788
788
789 Raises ``KeyError`` if the path does not exist in the manifest.
789 Raises ``KeyError`` if the path does not exist in the manifest.
790 """
790 """
791
791
792 def __len__():
792 def __len__():
793 """Return the number of entries in the manifest."""
793 """Return the number of entries in the manifest."""
794
794
795 def __nonzero__():
795 def __nonzero__():
796 """Returns True if the manifest has entries, False otherwise."""
796 """Returns True if the manifest has entries, False otherwise."""
797
797
798 __bool__ = __nonzero__
798 __bool__ = __nonzero__
799
799
800 def __setitem__(path, node):
800 def __setitem__(path, node):
801 """Define the node value for a path in the manifest.
801 """Define the node value for a path in the manifest.
802
802
803 If the path is already in the manifest, its flags will be copied to
803 If the path is already in the manifest, its flags will be copied to
804 the new entry.
804 the new entry.
805 """
805 """
806
806
807 def __contains__(path):
807 def __contains__(path):
808 """Whether a path exists in the manifest."""
808 """Whether a path exists in the manifest."""
809
809
810 def __delitem__(path):
810 def __delitem__(path):
811 """Remove a path from the manifest.
811 """Remove a path from the manifest.
812
812
813 Raises ``KeyError`` if the path is not in the manifest.
813 Raises ``KeyError`` if the path is not in the manifest.
814 """
814 """
815
815
816 def __iter__():
816 def __iter__():
817 """Iterate over paths in the manifest."""
817 """Iterate over paths in the manifest."""
818
818
819 def iterkeys():
819 def iterkeys():
820 """Iterate over paths in the manifest."""
820 """Iterate over paths in the manifest."""
821
821
822 def keys():
822 def keys():
823 """Obtain a list of paths in the manifest."""
823 """Obtain a list of paths in the manifest."""
824
824
825 def filesnotin(other, match=None):
825 def filesnotin(other, match=None):
826 """Obtain the set of paths in this manifest but not in another.
826 """Obtain the set of paths in this manifest but not in another.
827
827
828 ``match`` is an optional matcher function to be applied to both
828 ``match`` is an optional matcher function to be applied to both
829 manifests.
829 manifests.
830
830
831 Returns a set of paths.
831 Returns a set of paths.
832 """
832 """
833
833
834 def dirs():
834 def dirs():
835 """Returns an object implementing the ``idirs`` interface."""
835 """Returns an object implementing the ``idirs`` interface."""
836
836
837 def hasdir(dir):
837 def hasdir(dir):
838 """Returns a bool indicating if a directory is in this manifest."""
838 """Returns a bool indicating if a directory is in this manifest."""
839
839
840 def matches(match):
840 def matches(match):
841 """Generate a new manifest filtered through a matcher.
841 """Generate a new manifest filtered through a matcher.
842
842
843 Returns an object conforming to the ``imanifestdict`` interface.
843 Returns an object conforming to the ``imanifestdict`` interface.
844 """
844 """
845
845
846 def walk(match):
846 def walk(match):
847 """Generator of paths in manifest satisfying a matcher.
847 """Generator of paths in manifest satisfying a matcher.
848
848
849 This is equivalent to ``self.matches(match).iterkeys()`` except a new
849 This is equivalent to ``self.matches(match).iterkeys()`` except a new
850 manifest object is not created.
850 manifest object is not created.
851
851
852 If the matcher has explicit files listed and they don't exist in
852 If the matcher has explicit files listed and they don't exist in
853 the manifest, ``match.bad()`` is called for each missing file.
853 the manifest, ``match.bad()`` is called for each missing file.
854 """
854 """
855
855
856 def diff(other, match=None, clean=False):
856 def diff(other, match=None, clean=False):
857 """Find differences between this manifest and another.
857 """Find differences between this manifest and another.
858
858
859 This manifest is compared to ``other``.
859 This manifest is compared to ``other``.
860
860
861 If ``match`` is provided, the two manifests are filtered against this
861 If ``match`` is provided, the two manifests are filtered against this
862 matcher and only entries satisfying the matcher are compared.
862 matcher and only entries satisfying the matcher are compared.
863
863
864 If ``clean`` is True, unchanged files are included in the returned
864 If ``clean`` is True, unchanged files are included in the returned
865 object.
865 object.
866
866
867 Returns a dict with paths as keys and values of 2-tuples of 2-tuples of
867 Returns a dict with paths as keys and values of 2-tuples of 2-tuples of
868 the form ``((node1, flag1), (node2, flag2))`` where ``(node1, flag1)``
868 the form ``((node1, flag1), (node2, flag2))`` where ``(node1, flag1)``
869 represents the node and flags for this manifest and ``(node2, flag2)``
869 represents the node and flags for this manifest and ``(node2, flag2)``
870 are the same for the other manifest.
870 are the same for the other manifest.
871 """
871 """
872
872
873 def setflag(path, flag):
873 def setflag(path, flag):
874 """Set the flag value for a given path.
874 """Set the flag value for a given path.
875
875
876 Raises ``KeyError`` if the path is not already in the manifest.
876 Raises ``KeyError`` if the path is not already in the manifest.
877 """
877 """
878
878
879 def get(path, default=None):
879 def get(path, default=None):
880 """Obtain the node value for a path or a default value if missing."""
880 """Obtain the node value for a path or a default value if missing."""
881
881
882 def flags(path, default=''):
882 def flags(path, default=''):
883 """Return the flags value for a path or a default value if missing."""
883 """Return the flags value for a path or a default value if missing."""
884
884
885 def copy():
885 def copy():
886 """Return a copy of this manifest."""
886 """Return a copy of this manifest."""
887
887
888 def items():
888 def items():
889 """Returns an iterable of (path, node) for items in this manifest."""
889 """Returns an iterable of (path, node) for items in this manifest."""
890
890
891 def iteritems():
891 def iteritems():
892 """Identical to items()."""
892 """Identical to items()."""
893
893
894 def iterentries():
894 def iterentries():
895 """Returns an iterable of (path, node, flags) for this manifest.
895 """Returns an iterable of (path, node, flags) for this manifest.
896
896
897 Similar to ``iteritems()`` except items are a 3-tuple and include
897 Similar to ``iteritems()`` except items are a 3-tuple and include
898 flags.
898 flags.
899 """
899 """
900
900
901 def text():
901 def text():
902 """Obtain the raw data representation for this manifest.
902 """Obtain the raw data representation for this manifest.
903
903
904 Result is used to create a manifest revision.
904 Result is used to create a manifest revision.
905 """
905 """
906
906
907 def fastdelta(base, changes):
907 def fastdelta(base, changes):
908 """Obtain a delta between this manifest and another given changes.
908 """Obtain a delta between this manifest and another given changes.
909
909
910 ``base`` in the raw data representation for another manifest.
910 ``base`` in the raw data representation for another manifest.
911
911
912 ``changes`` is an iterable of ``(path, to_delete)``.
912 ``changes`` is an iterable of ``(path, to_delete)``.
913
913
914 Returns a 2-tuple containing ``bytearray(self.text())`` and the
914 Returns a 2-tuple containing ``bytearray(self.text())`` and the
915 delta between ``base`` and this manifest.
915 delta between ``base`` and this manifest.
916 """
916 """
917
917
918 class imanifestrevisionbase(interfaceutil.Interface):
918 class imanifestrevisionbase(interfaceutil.Interface):
919 """Base interface representing a single revision of a manifest.
919 """Base interface representing a single revision of a manifest.
920
920
921 Should not be used as a primary interface: should always be inherited
921 Should not be used as a primary interface: should always be inherited
922 as part of a larger interface.
922 as part of a larger interface.
923 """
923 """
924
924
925 def new():
925 def new():
926 """Obtain a new manifest instance.
926 """Obtain a new manifest instance.
927
927
928 Returns an object conforming to the ``imanifestrevisionwritable``
928 Returns an object conforming to the ``imanifestrevisionwritable``
929 interface. The instance will be associated with the same
929 interface. The instance will be associated with the same
930 ``imanifestlog`` collection as this instance.
930 ``imanifestlog`` collection as this instance.
931 """
931 """
932
932
933 def copy():
933 def copy():
934 """Obtain a copy of this manifest instance.
934 """Obtain a copy of this manifest instance.
935
935
936 Returns an object conforming to the ``imanifestrevisionwritable``
936 Returns an object conforming to the ``imanifestrevisionwritable``
937 interface. The instance will be associated with the same
937 interface. The instance will be associated with the same
938 ``imanifestlog`` collection as this instance.
938 ``imanifestlog`` collection as this instance.
939 """
939 """
940
940
941 def read():
941 def read():
942 """Obtain the parsed manifest data structure.
942 """Obtain the parsed manifest data structure.
943
943
944 The returned object conforms to the ``imanifestdict`` interface.
944 The returned object conforms to the ``imanifestdict`` interface.
945 """
945 """
946
946
947 class imanifestrevisionstored(imanifestrevisionbase):
947 class imanifestrevisionstored(imanifestrevisionbase):
948 """Interface representing a manifest revision committed to storage."""
948 """Interface representing a manifest revision committed to storage."""
949
949
950 def node():
950 def node():
951 """The binary node for this manifest."""
951 """The binary node for this manifest."""
952
952
953 parents = interfaceutil.Attribute(
953 parents = interfaceutil.Attribute(
954 """List of binary nodes that are parents for this manifest revision."""
954 """List of binary nodes that are parents for this manifest revision."""
955 )
955 )
956
956
957 def readdelta(shallow=False):
957 def readdelta(shallow=False):
958 """Obtain the manifest data structure representing changes from parent.
958 """Obtain the manifest data structure representing changes from parent.
959
959
960 This manifest is compared to its 1st parent. A new manifest representing
960 This manifest is compared to its 1st parent. A new manifest representing
961 those differences is constructed.
961 those differences is constructed.
962
962
963 The returned object conforms to the ``imanifestdict`` interface.
963 The returned object conforms to the ``imanifestdict`` interface.
964 """
964 """
965
965
966 def readfast(shallow=False):
966 def readfast(shallow=False):
967 """Calls either ``read()`` or ``readdelta()``.
967 """Calls either ``read()`` or ``readdelta()``.
968
968
969 The faster of the two options is called.
969 The faster of the two options is called.
970 """
970 """
971
971
972 def find(key):
972 def find(key):
973 """Calls self.read().find(key)``.
973 """Calls self.read().find(key)``.
974
974
975 Returns a 2-tuple of ``(node, flags)`` or raises ``KeyError``.
975 Returns a 2-tuple of ``(node, flags)`` or raises ``KeyError``.
976 """
976 """
977
977
978 class imanifestrevisionwritable(imanifestrevisionbase):
978 class imanifestrevisionwritable(imanifestrevisionbase):
979 """Interface representing a manifest revision that can be committed."""
979 """Interface representing a manifest revision that can be committed."""
980
980
981 def write(transaction, linkrev, p1node, p2node, added, removed):
981 def write(transaction, linkrev, p1node, p2node, added, removed):
982 """Add this revision to storage.
982 """Add this revision to storage.
983
983
984 Takes a transaction object, the changeset revision number it will
984 Takes a transaction object, the changeset revision number it will
985 be associated with, its parent nodes, and lists of added and
985 be associated with, its parent nodes, and lists of added and
986 removed paths.
986 removed paths.
987
987
988 Returns the binary node of the created revision.
988 Returns the binary node of the created revision.
989 """
989 """
990
990
991 class imanifestlog(interfaceutil.Interface):
991 class imanifestlog(interfaceutil.Interface):
992 """Interface representing a collection of manifest snapshots."""
992 """Interface representing a collection of manifest snapshots.
993
994 Represents the root manifest in a repository.
995
996 Also serves as a means to access nested tree manifests and to cache
997 tree manifests.
998 """
993
999
994 def __getitem__(node):
1000 def __getitem__(node):
995 """Obtain a manifest instance for a given binary node.
1001 """Obtain a manifest instance for a given binary node.
996
1002
997 Equivalent to calling ``self.get('', node)``.
1003 Equivalent to calling ``self.get('', node)``.
998
1004
999 The returned object conforms to the ``imanifestrevisionstored``
1005 The returned object conforms to the ``imanifestrevisionstored``
1000 interface.
1006 interface.
1001 """
1007 """
1002
1008
1003 def get(tree, node, verify=True):
1009 def get(tree, node, verify=True):
1004 """Retrieve the manifest instance for a given directory and binary node.
1010 """Retrieve the manifest instance for a given directory and binary node.
1005
1011
1006 ``node`` always refers to the node of the root manifest (which will be
1012 ``node`` always refers to the node of the root manifest (which will be
1007 the only manifest if flat manifests are being used).
1013 the only manifest if flat manifests are being used).
1008
1014
1009 If ``tree`` is the empty string, the root manifest is returned.
1015 If ``tree`` is the empty string, the root manifest is returned.
1010 Otherwise the manifest for the specified directory will be returned
1016 Otherwise the manifest for the specified directory will be returned
1011 (requires tree manifests).
1017 (requires tree manifests).
1012
1018
1013 If ``verify`` is True, ``LookupError`` is raised if the node is not
1019 If ``verify`` is True, ``LookupError`` is raised if the node is not
1014 known.
1020 known.
1015
1021
1016 The returned object conforms to the ``imanifestrevisionstored``
1022 The returned object conforms to the ``imanifestrevisionstored``
1017 interface.
1023 interface.
1018 """
1024 """
1019
1025
1020 def clearcaches():
1026 def clearcaches():
1021 """Clear caches associated with this collection."""
1027 """Clear caches associated with this collection."""
1022
1028
1023 def rev(node):
1029 def rev(node):
1024 """Obtain the revision number for a binary node.
1030 """Obtain the revision number for a binary node.
1025
1031
1026 Raises ``error.LookupError`` if the node is not known.
1032 Raises ``error.LookupError`` if the node is not known.
1027 """
1033 """
1028
1034
1029 def addgroup(deltas, linkmapper, transaction):
1035 def addgroup(deltas, linkmapper, transaction):
1030 """Process a series of deltas for storage.
1036 """Process a series of deltas for storage.
1031
1037
1032 ``deltas`` is an iterable of 7-tuples of
1038 ``deltas`` is an iterable of 7-tuples of
1033 (node, p1, p2, linknode, deltabase, delta, flags) defining revisions
1039 (node, p1, p2, linknode, deltabase, delta, flags) defining revisions
1034 to add.
1040 to add.
1035
1041
1036 The ``delta`` field contains ``mpatch`` data to apply to a base
1042 The ``delta`` field contains ``mpatch`` data to apply to a base
1037 revision, identified by ``deltabase``. The base node can be
1043 revision, identified by ``deltabase``. The base node can be
1038 ``nullid``, in which case the header from the delta can be ignored
1044 ``nullid``, in which case the header from the delta can be ignored
1039 and the delta used as the fulltext.
1045 and the delta used as the fulltext.
1040
1046
1041 Returns a list of nodes that were processed. A node will be in the list
1047 Returns a list of nodes that were processed. A node will be in the list
1042 even if it existed in the store previously.
1048 even if it existed in the store previously.
1043 """
1049 """
1044
1050
1045 class completelocalrepository(interfaceutil.Interface):
1051 class completelocalrepository(interfaceutil.Interface):
1046 """Monolithic interface for local repositories.
1052 """Monolithic interface for local repositories.
1047
1053
1048 This currently captures the reality of things - not how things should be.
1054 This currently captures the reality of things - not how things should be.
1049 """
1055 """
1050
1056
1051 supportedformats = interfaceutil.Attribute(
1057 supportedformats = interfaceutil.Attribute(
1052 """Set of requirements that apply to stream clone.
1058 """Set of requirements that apply to stream clone.
1053
1059
1054 This is actually a class attribute and is shared among all instances.
1060 This is actually a class attribute and is shared among all instances.
1055 """)
1061 """)
1056
1062
1057 openerreqs = interfaceutil.Attribute(
1063 openerreqs = interfaceutil.Attribute(
1058 """Set of requirements that are passed to the opener.
1064 """Set of requirements that are passed to the opener.
1059
1065
1060 This is actually a class attribute and is shared among all instances.
1066 This is actually a class attribute and is shared among all instances.
1061 """)
1067 """)
1062
1068
1063 supported = interfaceutil.Attribute(
1069 supported = interfaceutil.Attribute(
1064 """Set of requirements that this repo is capable of opening.""")
1070 """Set of requirements that this repo is capable of opening.""")
1065
1071
1066 requirements = interfaceutil.Attribute(
1072 requirements = interfaceutil.Attribute(
1067 """Set of requirements this repo uses.""")
1073 """Set of requirements this repo uses.""")
1068
1074
1069 filtername = interfaceutil.Attribute(
1075 filtername = interfaceutil.Attribute(
1070 """Name of the repoview that is active on this repo.""")
1076 """Name of the repoview that is active on this repo.""")
1071
1077
1072 wvfs = interfaceutil.Attribute(
1078 wvfs = interfaceutil.Attribute(
1073 """VFS used to access the working directory.""")
1079 """VFS used to access the working directory.""")
1074
1080
1075 vfs = interfaceutil.Attribute(
1081 vfs = interfaceutil.Attribute(
1076 """VFS rooted at the .hg directory.
1082 """VFS rooted at the .hg directory.
1077
1083
1078 Used to access repository data not in the store.
1084 Used to access repository data not in the store.
1079 """)
1085 """)
1080
1086
1081 svfs = interfaceutil.Attribute(
1087 svfs = interfaceutil.Attribute(
1082 """VFS rooted at the store.
1088 """VFS rooted at the store.
1083
1089
1084 Used to access repository data in the store. Typically .hg/store.
1090 Used to access repository data in the store. Typically .hg/store.
1085 But can point elsewhere if the store is shared.
1091 But can point elsewhere if the store is shared.
1086 """)
1092 """)
1087
1093
1088 root = interfaceutil.Attribute(
1094 root = interfaceutil.Attribute(
1089 """Path to the root of the working directory.""")
1095 """Path to the root of the working directory.""")
1090
1096
1091 path = interfaceutil.Attribute(
1097 path = interfaceutil.Attribute(
1092 """Path to the .hg directory.""")
1098 """Path to the .hg directory.""")
1093
1099
1094 origroot = interfaceutil.Attribute(
1100 origroot = interfaceutil.Attribute(
1095 """The filesystem path that was used to construct the repo.""")
1101 """The filesystem path that was used to construct the repo.""")
1096
1102
1097 auditor = interfaceutil.Attribute(
1103 auditor = interfaceutil.Attribute(
1098 """A pathauditor for the working directory.
1104 """A pathauditor for the working directory.
1099
1105
1100 This checks if a path refers to a nested repository.
1106 This checks if a path refers to a nested repository.
1101
1107
1102 Operates on the filesystem.
1108 Operates on the filesystem.
1103 """)
1109 """)
1104
1110
1105 nofsauditor = interfaceutil.Attribute(
1111 nofsauditor = interfaceutil.Attribute(
1106 """A pathauditor for the working directory.
1112 """A pathauditor for the working directory.
1107
1113
1108 This is like ``auditor`` except it doesn't do filesystem checks.
1114 This is like ``auditor`` except it doesn't do filesystem checks.
1109 """)
1115 """)
1110
1116
1111 baseui = interfaceutil.Attribute(
1117 baseui = interfaceutil.Attribute(
1112 """Original ui instance passed into constructor.""")
1118 """Original ui instance passed into constructor.""")
1113
1119
1114 ui = interfaceutil.Attribute(
1120 ui = interfaceutil.Attribute(
1115 """Main ui instance for this instance.""")
1121 """Main ui instance for this instance.""")
1116
1122
1117 sharedpath = interfaceutil.Attribute(
1123 sharedpath = interfaceutil.Attribute(
1118 """Path to the .hg directory of the repo this repo was shared from.""")
1124 """Path to the .hg directory of the repo this repo was shared from.""")
1119
1125
1120 store = interfaceutil.Attribute(
1126 store = interfaceutil.Attribute(
1121 """A store instance.""")
1127 """A store instance.""")
1122
1128
1123 spath = interfaceutil.Attribute(
1129 spath = interfaceutil.Attribute(
1124 """Path to the store.""")
1130 """Path to the store.""")
1125
1131
1126 sjoin = interfaceutil.Attribute(
1132 sjoin = interfaceutil.Attribute(
1127 """Alias to self.store.join.""")
1133 """Alias to self.store.join.""")
1128
1134
1129 cachevfs = interfaceutil.Attribute(
1135 cachevfs = interfaceutil.Attribute(
1130 """A VFS used to access the cache directory.
1136 """A VFS used to access the cache directory.
1131
1137
1132 Typically .hg/cache.
1138 Typically .hg/cache.
1133 """)
1139 """)
1134
1140
1135 filteredrevcache = interfaceutil.Attribute(
1141 filteredrevcache = interfaceutil.Attribute(
1136 """Holds sets of revisions to be filtered.""")
1142 """Holds sets of revisions to be filtered.""")
1137
1143
1138 names = interfaceutil.Attribute(
1144 names = interfaceutil.Attribute(
1139 """A ``namespaces`` instance.""")
1145 """A ``namespaces`` instance.""")
1140
1146
1141 def close():
1147 def close():
1142 """Close the handle on this repository."""
1148 """Close the handle on this repository."""
1143
1149
1144 def peer():
1150 def peer():
1145 """Obtain an object conforming to the ``peer`` interface."""
1151 """Obtain an object conforming to the ``peer`` interface."""
1146
1152
1147 def unfiltered():
1153 def unfiltered():
1148 """Obtain an unfiltered/raw view of this repo."""
1154 """Obtain an unfiltered/raw view of this repo."""
1149
1155
1150 def filtered(name, visibilityexceptions=None):
1156 def filtered(name, visibilityexceptions=None):
1151 """Obtain a named view of this repository."""
1157 """Obtain a named view of this repository."""
1152
1158
1153 obsstore = interfaceutil.Attribute(
1159 obsstore = interfaceutil.Attribute(
1154 """A store of obsolescence data.""")
1160 """A store of obsolescence data.""")
1155
1161
1156 changelog = interfaceutil.Attribute(
1162 changelog = interfaceutil.Attribute(
1157 """A handle on the changelog revlog.""")
1163 """A handle on the changelog revlog.""")
1158
1164
1159 manifestlog = interfaceutil.Attribute(
1165 manifestlog = interfaceutil.Attribute(
1160 """An instance conforming to the ``imanifestlog`` interface.
1166 """An instance conforming to the ``imanifestlog`` interface.
1161
1167
1162 Provides access to manifests for the repository.
1168 Provides access to manifests for the repository.
1163 """)
1169 """)
1164
1170
1165 dirstate = interfaceutil.Attribute(
1171 dirstate = interfaceutil.Attribute(
1166 """Working directory state.""")
1172 """Working directory state.""")
1167
1173
1168 narrowpats = interfaceutil.Attribute(
1174 narrowpats = interfaceutil.Attribute(
1169 """Matcher patterns for this repository's narrowspec.""")
1175 """Matcher patterns for this repository's narrowspec.""")
1170
1176
1171 def narrowmatch():
1177 def narrowmatch():
1172 """Obtain a matcher for the narrowspec."""
1178 """Obtain a matcher for the narrowspec."""
1173
1179
1174 def setnarrowpats(newincludes, newexcludes):
1180 def setnarrowpats(newincludes, newexcludes):
1175 """Define the narrowspec for this repository."""
1181 """Define the narrowspec for this repository."""
1176
1182
1177 def __getitem__(changeid):
1183 def __getitem__(changeid):
1178 """Try to resolve a changectx."""
1184 """Try to resolve a changectx."""
1179
1185
1180 def __contains__(changeid):
1186 def __contains__(changeid):
1181 """Whether a changeset exists."""
1187 """Whether a changeset exists."""
1182
1188
1183 def __nonzero__():
1189 def __nonzero__():
1184 """Always returns True."""
1190 """Always returns True."""
1185 return True
1191 return True
1186
1192
1187 __bool__ = __nonzero__
1193 __bool__ = __nonzero__
1188
1194
1189 def __len__():
1195 def __len__():
1190 """Returns the number of changesets in the repo."""
1196 """Returns the number of changesets in the repo."""
1191
1197
1192 def __iter__():
1198 def __iter__():
1193 """Iterate over revisions in the changelog."""
1199 """Iterate over revisions in the changelog."""
1194
1200
1195 def revs(expr, *args):
1201 def revs(expr, *args):
1196 """Evaluate a revset.
1202 """Evaluate a revset.
1197
1203
1198 Emits revisions.
1204 Emits revisions.
1199 """
1205 """
1200
1206
1201 def set(expr, *args):
1207 def set(expr, *args):
1202 """Evaluate a revset.
1208 """Evaluate a revset.
1203
1209
1204 Emits changectx instances.
1210 Emits changectx instances.
1205 """
1211 """
1206
1212
1207 def anyrevs(specs, user=False, localalias=None):
1213 def anyrevs(specs, user=False, localalias=None):
1208 """Find revisions matching one of the given revsets."""
1214 """Find revisions matching one of the given revsets."""
1209
1215
1210 def url():
1216 def url():
1211 """Returns a string representing the location of this repo."""
1217 """Returns a string representing the location of this repo."""
1212
1218
1213 def hook(name, throw=False, **args):
1219 def hook(name, throw=False, **args):
1214 """Call a hook."""
1220 """Call a hook."""
1215
1221
1216 def tags():
1222 def tags():
1217 """Return a mapping of tag to node."""
1223 """Return a mapping of tag to node."""
1218
1224
1219 def tagtype(tagname):
1225 def tagtype(tagname):
1220 """Return the type of a given tag."""
1226 """Return the type of a given tag."""
1221
1227
1222 def tagslist():
1228 def tagslist():
1223 """Return a list of tags ordered by revision."""
1229 """Return a list of tags ordered by revision."""
1224
1230
1225 def nodetags(node):
1231 def nodetags(node):
1226 """Return the tags associated with a node."""
1232 """Return the tags associated with a node."""
1227
1233
1228 def nodebookmarks(node):
1234 def nodebookmarks(node):
1229 """Return the list of bookmarks pointing to the specified node."""
1235 """Return the list of bookmarks pointing to the specified node."""
1230
1236
1231 def branchmap():
1237 def branchmap():
1232 """Return a mapping of branch to heads in that branch."""
1238 """Return a mapping of branch to heads in that branch."""
1233
1239
1234 def revbranchcache():
1240 def revbranchcache():
1235 pass
1241 pass
1236
1242
1237 def branchtip(branchtip, ignoremissing=False):
1243 def branchtip(branchtip, ignoremissing=False):
1238 """Return the tip node for a given branch."""
1244 """Return the tip node for a given branch."""
1239
1245
1240 def lookup(key):
1246 def lookup(key):
1241 """Resolve the node for a revision."""
1247 """Resolve the node for a revision."""
1242
1248
1243 def lookupbranch(key):
1249 def lookupbranch(key):
1244 """Look up the branch name of the given revision or branch name."""
1250 """Look up the branch name of the given revision or branch name."""
1245
1251
1246 def known(nodes):
1252 def known(nodes):
1247 """Determine whether a series of nodes is known.
1253 """Determine whether a series of nodes is known.
1248
1254
1249 Returns a list of bools.
1255 Returns a list of bools.
1250 """
1256 """
1251
1257
1252 def local():
1258 def local():
1253 """Whether the repository is local."""
1259 """Whether the repository is local."""
1254 return True
1260 return True
1255
1261
1256 def publishing():
1262 def publishing():
1257 """Whether the repository is a publishing repository."""
1263 """Whether the repository is a publishing repository."""
1258
1264
1259 def cancopy():
1265 def cancopy():
1260 pass
1266 pass
1261
1267
1262 def shared():
1268 def shared():
1263 """The type of shared repository or None."""
1269 """The type of shared repository or None."""
1264
1270
1265 def wjoin(f, *insidef):
1271 def wjoin(f, *insidef):
1266 """Calls self.vfs.reljoin(self.root, f, *insidef)"""
1272 """Calls self.vfs.reljoin(self.root, f, *insidef)"""
1267
1273
1268 def file(f):
1274 def file(f):
1269 """Obtain a filelog for a tracked path.
1275 """Obtain a filelog for a tracked path.
1270
1276
1271 The returned type conforms to the ``ifilestorage`` interface.
1277 The returned type conforms to the ``ifilestorage`` interface.
1272 """
1278 """
1273
1279
1274 def setparents(p1, p2):
1280 def setparents(p1, p2):
1275 """Set the parent nodes of the working directory."""
1281 """Set the parent nodes of the working directory."""
1276
1282
1277 def filectx(path, changeid=None, fileid=None):
1283 def filectx(path, changeid=None, fileid=None):
1278 """Obtain a filectx for the given file revision."""
1284 """Obtain a filectx for the given file revision."""
1279
1285
1280 def getcwd():
1286 def getcwd():
1281 """Obtain the current working directory from the dirstate."""
1287 """Obtain the current working directory from the dirstate."""
1282
1288
1283 def pathto(f, cwd=None):
1289 def pathto(f, cwd=None):
1284 """Obtain the relative path to a file."""
1290 """Obtain the relative path to a file."""
1285
1291
1286 def adddatafilter(name, fltr):
1292 def adddatafilter(name, fltr):
1287 pass
1293 pass
1288
1294
1289 def wread(filename):
1295 def wread(filename):
1290 """Read a file from wvfs, using data filters."""
1296 """Read a file from wvfs, using data filters."""
1291
1297
1292 def wwrite(filename, data, flags, backgroundclose=False, **kwargs):
1298 def wwrite(filename, data, flags, backgroundclose=False, **kwargs):
1293 """Write data to a file in the wvfs, using data filters."""
1299 """Write data to a file in the wvfs, using data filters."""
1294
1300
1295 def wwritedata(filename, data):
1301 def wwritedata(filename, data):
1296 """Resolve data for writing to the wvfs, using data filters."""
1302 """Resolve data for writing to the wvfs, using data filters."""
1297
1303
1298 def currenttransaction():
1304 def currenttransaction():
1299 """Obtain the current transaction instance or None."""
1305 """Obtain the current transaction instance or None."""
1300
1306
1301 def transaction(desc, report=None):
1307 def transaction(desc, report=None):
1302 """Open a new transaction to write to the repository."""
1308 """Open a new transaction to write to the repository."""
1303
1309
1304 def undofiles():
1310 def undofiles():
1305 """Returns a list of (vfs, path) for files to undo transactions."""
1311 """Returns a list of (vfs, path) for files to undo transactions."""
1306
1312
1307 def recover():
1313 def recover():
1308 """Roll back an interrupted transaction."""
1314 """Roll back an interrupted transaction."""
1309
1315
1310 def rollback(dryrun=False, force=False):
1316 def rollback(dryrun=False, force=False):
1311 """Undo the last transaction.
1317 """Undo the last transaction.
1312
1318
1313 DANGEROUS.
1319 DANGEROUS.
1314 """
1320 """
1315
1321
1316 def updatecaches(tr=None, full=False):
1322 def updatecaches(tr=None, full=False):
1317 """Warm repo caches."""
1323 """Warm repo caches."""
1318
1324
1319 def invalidatecaches():
1325 def invalidatecaches():
1320 """Invalidate cached data due to the repository mutating."""
1326 """Invalidate cached data due to the repository mutating."""
1321
1327
1322 def invalidatevolatilesets():
1328 def invalidatevolatilesets():
1323 pass
1329 pass
1324
1330
1325 def invalidatedirstate():
1331 def invalidatedirstate():
1326 """Invalidate the dirstate."""
1332 """Invalidate the dirstate."""
1327
1333
1328 def invalidate(clearfilecache=False):
1334 def invalidate(clearfilecache=False):
1329 pass
1335 pass
1330
1336
1331 def invalidateall():
1337 def invalidateall():
1332 pass
1338 pass
1333
1339
1334 def lock(wait=True):
1340 def lock(wait=True):
1335 """Lock the repository store and return a lock instance."""
1341 """Lock the repository store and return a lock instance."""
1336
1342
1337 def wlock(wait=True):
1343 def wlock(wait=True):
1338 """Lock the non-store parts of the repository."""
1344 """Lock the non-store parts of the repository."""
1339
1345
1340 def currentwlock():
1346 def currentwlock():
1341 """Return the wlock if it's held or None."""
1347 """Return the wlock if it's held or None."""
1342
1348
1343 def checkcommitpatterns(wctx, vdirs, match, status, fail):
1349 def checkcommitpatterns(wctx, vdirs, match, status, fail):
1344 pass
1350 pass
1345
1351
1346 def commit(text='', user=None, date=None, match=None, force=False,
1352 def commit(text='', user=None, date=None, match=None, force=False,
1347 editor=False, extra=None):
1353 editor=False, extra=None):
1348 """Add a new revision to the repository."""
1354 """Add a new revision to the repository."""
1349
1355
1350 def commitctx(ctx, error=False):
1356 def commitctx(ctx, error=False):
1351 """Commit a commitctx instance to the repository."""
1357 """Commit a commitctx instance to the repository."""
1352
1358
1353 def destroying():
1359 def destroying():
1354 """Inform the repository that nodes are about to be destroyed."""
1360 """Inform the repository that nodes are about to be destroyed."""
1355
1361
1356 def destroyed():
1362 def destroyed():
1357 """Inform the repository that nodes have been destroyed."""
1363 """Inform the repository that nodes have been destroyed."""
1358
1364
1359 def status(node1='.', node2=None, match=None, ignored=False,
1365 def status(node1='.', node2=None, match=None, ignored=False,
1360 clean=False, unknown=False, listsubrepos=False):
1366 clean=False, unknown=False, listsubrepos=False):
1361 """Convenience method to call repo[x].status()."""
1367 """Convenience method to call repo[x].status()."""
1362
1368
1363 def addpostdsstatus(ps):
1369 def addpostdsstatus(ps):
1364 pass
1370 pass
1365
1371
1366 def postdsstatus():
1372 def postdsstatus():
1367 pass
1373 pass
1368
1374
1369 def clearpostdsstatus():
1375 def clearpostdsstatus():
1370 pass
1376 pass
1371
1377
1372 def heads(start=None):
1378 def heads(start=None):
1373 """Obtain list of nodes that are DAG heads."""
1379 """Obtain list of nodes that are DAG heads."""
1374
1380
1375 def branchheads(branch=None, start=None, closed=False):
1381 def branchheads(branch=None, start=None, closed=False):
1376 pass
1382 pass
1377
1383
1378 def branches(nodes):
1384 def branches(nodes):
1379 pass
1385 pass
1380
1386
1381 def between(pairs):
1387 def between(pairs):
1382 pass
1388 pass
1383
1389
1384 def checkpush(pushop):
1390 def checkpush(pushop):
1385 pass
1391 pass
1386
1392
1387 prepushoutgoinghooks = interfaceutil.Attribute(
1393 prepushoutgoinghooks = interfaceutil.Attribute(
1388 """util.hooks instance.""")
1394 """util.hooks instance.""")
1389
1395
1390 def pushkey(namespace, key, old, new):
1396 def pushkey(namespace, key, old, new):
1391 pass
1397 pass
1392
1398
1393 def listkeys(namespace):
1399 def listkeys(namespace):
1394 pass
1400 pass
1395
1401
1396 def debugwireargs(one, two, three=None, four=None, five=None):
1402 def debugwireargs(one, two, three=None, four=None, five=None):
1397 pass
1403 pass
1398
1404
1399 def savecommitmessage(text):
1405 def savecommitmessage(text):
1400 pass
1406 pass
General Comments 0
You need to be logged in to leave comments. Login now