author | Gregory Szorc <gregory.szorc@gmail.com> |
Tue, 03 Apr 2018 10:04:30 -0700 | |
changeset 37343 | 0611c954da90 |
parent 37320 | 39f7d4ee8bcd |
child 37351 | fdd22bf6398f |
permissions | -rw-r--r-- |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 |
# repository.py - Interfaces and base classes for repositories and peers. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
# |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
# Copyright 2017 Gregory Szorc <gregory.szorc@gmail.com> |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
# |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 |
# This software may be used and distributed according to the terms of the |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 |
# GNU General Public License version 2 or any later version. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 |
from __future__ import absolute_import |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 |
|
33802
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
10 |
from .i18n import _ |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
11 |
from .thirdparty.zope import ( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
12 |
interface as zi, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
13 |
) |
33802
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
14 |
from . import ( |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
15 |
error, |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
16 |
) |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
17 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
18 |
class ipeerconnection(zi.Interface): |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 |
"""Represents a "connection" to a repository. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
This is the base interface for representing a connection to a repository. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
It holds basic properties and methods applicable to all peer types. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 |
This is not a complete interface definition and should not be used |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 |
outside of this module. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
""" |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
27 |
ui = zi.Attribute("""ui.ui instance""") |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
29 |
def url(): |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 |
"""Returns a URL string representing this peer. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 |
Currently, implementations expose the raw URL used to construct the |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 |
instance. It may contain credentials as part of the URL. The |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 |
expectations of the value aren't well-defined and this could lead to |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 |
data leakage. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 |
TODO audit/clean consumers and more clearly define the contents of this |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 |
value. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 |
""" |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
41 |
def local(): |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
"""Returns a local repository instance. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 |
If the peer represents a local repository, returns an object that |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 |
can be used to interface with it. Otherwise returns ``None``. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 |
""" |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
48 |
def peer(): |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 |
"""Returns an object conforming to this interface. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 |
Most implementations will ``return self``. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 |
""" |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
54 |
def canpush(): |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 |
"""Returns a boolean indicating if this peer can be pushed to.""" |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
57 |
def close(): |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 |
"""Close the connection to this peer. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
|
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 |
This is called when the peer will no longer be used. Resources |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 |
associated with the peer should be cleaned up. |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 |
""" |
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
64 |
class ipeercommands(zi.Interface): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
65 |
"""Client-side interface for communicating over the wire protocol. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
66 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
67 |
This interface is used as a gateway to the Mercurial wire protocol. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
68 |
methods commonly call wire protocol commands of the same name. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
69 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
70 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
71 |
def branchmap(): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
72 |
"""Obtain heads in named branches. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
73 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
74 |
Returns a dict mapping branch name to an iterable of nodes that are |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
75 |
heads on that branch. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
76 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
77 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
78 |
def capabilities(): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
79 |
"""Obtain capabilities of the peer. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
80 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
81 |
Returns a set of string capabilities. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
82 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
83 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
84 |
def debugwireargs(one, two, three=None, four=None, five=None): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
85 |
"""Used to facilitate debugging of arguments passed over the wire.""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
86 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
87 |
def getbundle(source, **kwargs): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
88 |
"""Obtain remote repository data as a bundle. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
89 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
90 |
This command is how the bulk of repository data is transferred from |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
91 |
the peer to the local repository |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
92 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
93 |
Returns a generator of bundle data. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
94 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
95 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
96 |
def heads(): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
97 |
"""Determine all known head revisions in the peer. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
98 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
99 |
Returns an iterable of binary nodes. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
100 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
101 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
102 |
def known(nodes): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
103 |
"""Determine whether multiple nodes are known. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
104 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
105 |
Accepts an iterable of nodes whose presence to check for. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
106 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
107 |
Returns an iterable of booleans indicating of the corresponding node |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
108 |
at that index is known to the peer. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
109 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
110 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
111 |
def listkeys(namespace): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
112 |
"""Obtain all keys in a pushkey namespace. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
113 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
114 |
Returns an iterable of key names. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
115 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
116 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
117 |
def lookup(key): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
118 |
"""Resolve a value to a known revision. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
119 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
120 |
Returns a binary node of the resolved revision on success. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
121 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
122 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
123 |
def pushkey(namespace, key, old, new): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
124 |
"""Set a value using the ``pushkey`` protocol. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
125 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
126 |
Arguments correspond to the pushkey namespace and key to operate on and |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
127 |
the old and new values for that key. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
128 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
129 |
Returns a string with the peer result. The value inside varies by the |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
130 |
namespace. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
131 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
132 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
133 |
def stream_out(): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
134 |
"""Obtain streaming clone data. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
135 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
136 |
Successful result should be a generator of data chunks. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
137 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
138 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
139 |
def unbundle(bundle, heads, url): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
140 |
"""Transfer repository data to the peer. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
141 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
142 |
This is how the bulk of data during a push is transferred. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
143 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
144 |
Returns the integer number of heads added to the peer. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
145 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
146 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
147 |
class ipeerlegacycommands(zi.Interface): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
148 |
"""Interface for implementing support for legacy wire protocol commands. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
149 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
150 |
Wire protocol commands transition to legacy status when they are no longer |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
151 |
used by modern clients. To facilitate identifying which commands are |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
152 |
legacy, the interfaces are split. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
153 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
154 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
155 |
def between(pairs): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
156 |
"""Obtain nodes between pairs of nodes. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
157 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
158 |
``pairs`` is an iterable of node pairs. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
159 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
160 |
Returns an iterable of iterables of nodes corresponding to each |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
161 |
requested pair. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
162 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
163 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
164 |
def branches(nodes): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
165 |
"""Obtain ancestor changesets of specific nodes back to a branch point. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
166 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
167 |
For each requested node, the peer finds the first ancestor node that is |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
168 |
a DAG root or is a merge. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
169 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
170 |
Returns an iterable of iterables with the resolved values for each node. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
171 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
172 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
173 |
def changegroup(nodes, kind): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
174 |
"""Obtain a changegroup with data for descendants of specified nodes.""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
175 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
176 |
def changegroupsubset(bases, heads, kind): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
177 |
pass |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
178 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
179 |
class ipeerbase(ipeerconnection, ipeercommands): |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
180 |
"""Unified interface for peer repositories. |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
181 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
182 |
All peer instances must conform to this interface. |
33800
f257943e47ab
repository: formalize peer interface with abstract base class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
183 |
""" |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
184 |
def iterbatch(): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
185 |
"""Obtain an object to be used for multiple method calls. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
186 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
187 |
Various operations call several methods on peer instances. If each |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
188 |
method call were performed immediately and serially, this would |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
189 |
require round trips to remote peers and/or would slow down execution. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
190 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
191 |
Some peers have the ability to "batch" method calls to avoid costly |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
192 |
round trips or to facilitate concurrent execution. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
193 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
194 |
This method returns an object that can be used to indicate intent to |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
195 |
perform batched method calls. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
196 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
197 |
The returned object is a proxy of this peer. It intercepts calls to |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
198 |
batchable methods and queues them instead of performing them |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
199 |
immediately. This proxy object has a ``submit`` method that will |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
200 |
perform all queued batchable method calls. A ``results()`` method |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
201 |
exposes the results of queued/batched method calls. It is a generator |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
202 |
of results in the order they were called. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
203 |
|
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
204 |
Not all peers or wire protocol implementations may actually batch method |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
205 |
calls. However, they must all support this API. |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
206 |
""" |
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
207 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
208 |
def capable(name): |
33802
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
209 |
"""Determine support for a named capability. |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
210 |
|
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
211 |
Returns ``False`` if capability not supported. |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
212 |
|
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
213 |
Returns ``True`` if boolean capability is supported. Returns a string |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
214 |
if capability support is non-boolean. |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
215 |
""" |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
216 |
|
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
217 |
def requirecap(name, purpose): |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
218 |
"""Require a capability to be present. |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
219 |
|
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
220 |
Raises a ``CapabilityError`` if the capability isn't present. |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
221 |
""" |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
222 |
|
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
223 |
class ipeerbaselegacycommands(ipeerbase, ipeerlegacycommands): |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
224 |
"""Unified peer interface that supports legacy commands.""" |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
225 |
|
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
226 |
@zi.implementer(ipeerbase) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
227 |
class peer(object): |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
228 |
"""Base class for peer repositories.""" |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
229 |
|
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
230 |
def capable(self, name): |
33802
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
231 |
caps = self.capabilities() |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
232 |
if name in caps: |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
233 |
return True |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
234 |
|
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
235 |
name = '%s=' % name |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
236 |
for cap in caps: |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
237 |
if cap.startswith(name): |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
238 |
return cap[len(name):] |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
239 |
|
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
240 |
return False |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
241 |
|
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
242 |
def requirecap(self, name, purpose): |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
243 |
if self.capable(name): |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
244 |
return |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
245 |
|
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
246 |
raise error.CapabilityError( |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
247 |
_('cannot %s; remote repository does not support the %r ' |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
248 |
'capability') % (purpose, name)) |
a0aad86b3b6a
repository: implement generic capability methods on peer class
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33801
diff
changeset
|
249 |
|
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
250 |
@zi.implementer(ipeerbaselegacycommands) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37316
diff
changeset
|
251 |
class legacypeer(peer): |
33801
558f5b2ee10e
repository: formalize wire protocol interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33800
diff
changeset
|
252 |
"""peer but with support for legacy wire protocol commands.""" |
37181
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
253 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
254 |
class completelocalrepository(zi.Interface): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
255 |
"""Monolithic interface for local repositories. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
256 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
257 |
This currently captures the reality of things - not how things should be. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
258 |
""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
259 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
260 |
supportedformats = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
261 |
"""Set of requirements that apply to stream clone. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
262 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
263 |
This is actually a class attribute and is shared among all instances. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
264 |
""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
265 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
266 |
openerreqs = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
267 |
"""Set of requirements that are passed to the opener. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
268 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
269 |
This is actually a class attribute and is shared among all instances. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
270 |
""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
271 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
272 |
supported = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
273 |
"""Set of requirements that this repo is capable of opening.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
274 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
275 |
requirements = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
276 |
"""Set of requirements this repo uses.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
277 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
278 |
filtername = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
279 |
"""Name of the repoview that is active on this repo.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
280 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
281 |
wvfs = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
282 |
"""VFS used to access the working directory.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
283 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
284 |
vfs = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
285 |
"""VFS rooted at the .hg directory. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
286 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
287 |
Used to access repository data not in the store. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
288 |
""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
289 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
290 |
svfs = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
291 |
"""VFS rooted at the store. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
292 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
293 |
Used to access repository data in the store. Typically .hg/store. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
294 |
But can point elsewhere if the store is shared. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
295 |
""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
296 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
297 |
root = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
298 |
"""Path to the root of the working directory.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
299 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
300 |
path = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
301 |
"""Path to the .hg directory.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
302 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
303 |
origroot = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
304 |
"""The filesystem path that was used to construct the repo.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
305 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
306 |
auditor = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
307 |
"""A pathauditor for the working directory. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
308 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
309 |
This checks if a path refers to a nested repository. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
310 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
311 |
Operates on the filesystem. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
312 |
""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
313 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
314 |
nofsauditor = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
315 |
"""A pathauditor for the working directory. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
316 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
317 |
This is like ``auditor`` except it doesn't do filesystem checks. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
318 |
""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
319 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
320 |
baseui = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
321 |
"""Original ui instance passed into constructor.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
322 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
323 |
ui = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
324 |
"""Main ui instance for this instance.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
325 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
326 |
sharedpath = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
327 |
"""Path to the .hg directory of the repo this repo was shared from.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
328 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
329 |
store = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
330 |
"""A store instance.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
331 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
332 |
spath = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
333 |
"""Path to the store.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
334 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
335 |
sjoin = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
336 |
"""Alias to self.store.join.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
337 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
338 |
cachevfs = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
339 |
"""A VFS used to access the cache directory. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
340 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
341 |
Typically .hg/cache. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
342 |
""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
343 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
344 |
filteredrevcache = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
345 |
"""Holds sets of revisions to be filtered.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
346 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
347 |
names = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
348 |
"""A ``namespaces`` instance.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
349 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
350 |
def close(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
351 |
"""Close the handle on this repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
352 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
353 |
def peer(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
354 |
"""Obtain an object conforming to the ``peer`` interface.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
355 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
356 |
def unfiltered(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
357 |
"""Obtain an unfiltered/raw view of this repo.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
358 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
359 |
def filtered(name, visibilityexceptions=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
360 |
"""Obtain a named view of this repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
361 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
362 |
obsstore = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
363 |
"""A store of obsolescence data.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
364 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
365 |
changelog = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
366 |
"""A handle on the changelog revlog.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
367 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
368 |
manifestlog = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
369 |
"""A handle on the root manifest revlog.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
370 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
371 |
dirstate = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
372 |
"""Working directory state.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
373 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
374 |
narrowpats = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
375 |
"""Matcher patterns for this repository's narrowspec.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
376 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
377 |
def narrowmatch(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
378 |
"""Obtain a matcher for the narrowspec.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
379 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
380 |
def setnarrowpats(newincludes, newexcludes): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
381 |
"""Define the narrowspec for this repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
382 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
383 |
def __getitem__(changeid): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
384 |
"""Try to resolve a changectx.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
385 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
386 |
def __contains__(changeid): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
387 |
"""Whether a changeset exists.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
388 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
389 |
def __nonzero__(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
390 |
"""Always returns True.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
391 |
return True |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
392 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
393 |
__bool__ = __nonzero__ |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
394 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
395 |
def __len__(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
396 |
"""Returns the number of changesets in the repo.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
397 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
398 |
def __iter__(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
399 |
"""Iterate over revisions in the changelog.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
400 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
401 |
def revs(expr, *args): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
402 |
"""Evaluate a revset. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
403 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
404 |
Emits revisions. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
405 |
""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
406 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
407 |
def set(expr, *args): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
408 |
"""Evaluate a revset. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
409 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
410 |
Emits changectx instances. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
411 |
""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
412 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
413 |
def anyrevs(specs, user=False, localalias=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
414 |
"""Find revisions matching one of the given revsets.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
415 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
416 |
def url(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
417 |
"""Returns a string representing the location of this repo.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
418 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
419 |
def hook(name, throw=False, **args): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
420 |
"""Call a hook.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
421 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
422 |
def tags(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
423 |
"""Return a mapping of tag to node.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
424 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
425 |
def tagtype(tagname): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
426 |
"""Return the type of a given tag.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
427 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
428 |
def tagslist(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
429 |
"""Return a list of tags ordered by revision.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
430 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
431 |
def nodetags(node): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
432 |
"""Return the tags associated with a node.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
433 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
434 |
def nodebookmarks(node): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
435 |
"""Return the list of bookmarks pointing to the specified node.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
436 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
437 |
def branchmap(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
438 |
"""Return a mapping of branch to heads in that branch.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
439 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
440 |
def revbranchcache(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
441 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
442 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
443 |
def branchtip(branchtip, ignoremissing=False): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
444 |
"""Return the tip node for a given branch.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
445 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
446 |
def lookup(key): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
447 |
"""Resolve the node for a revision.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
448 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
449 |
def lookupbranch(key, remote=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
450 |
"""Look up the branch name of the given revision or branch name.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
451 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
452 |
def known(nodes): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
453 |
"""Determine whether a series of nodes is known. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
454 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
455 |
Returns a list of bools. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
456 |
""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
457 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
458 |
def local(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
459 |
"""Whether the repository is local.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
460 |
return True |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
461 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
462 |
def publishing(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
463 |
"""Whether the repository is a publishing repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
464 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
465 |
def cancopy(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
466 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
467 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
468 |
def shared(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
469 |
"""The type of shared repository or None.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
470 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
471 |
def wjoin(f, *insidef): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
472 |
"""Calls self.vfs.reljoin(self.root, f, *insidef)""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
473 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
474 |
def file(f): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
475 |
"""Obtain a filelog for a tracked path.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
476 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
477 |
def setparents(p1, p2): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
478 |
"""Set the parent nodes of the working directory.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
479 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
480 |
def filectx(path, changeid=None, fileid=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
481 |
"""Obtain a filectx for the given file revision.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
482 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
483 |
def getcwd(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
484 |
"""Obtain the current working directory from the dirstate.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
485 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
486 |
def pathto(f, cwd=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
487 |
"""Obtain the relative path to a file.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
488 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
489 |
def adddatafilter(name, fltr): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
490 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
491 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
492 |
def wread(filename): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
493 |
"""Read a file from wvfs, using data filters.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
494 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
495 |
def wwrite(filename, data, flags, backgroundclose=False, **kwargs): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
496 |
"""Write data to a file in the wvfs, using data filters.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
497 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
498 |
def wwritedata(filename, data): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
499 |
"""Resolve data for writing to the wvfs, using data filters.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
500 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
501 |
def currenttransaction(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
502 |
"""Obtain the current transaction instance or None.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
503 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
504 |
def transaction(desc, report=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
505 |
"""Open a new transaction to write to the repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
506 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
507 |
def undofiles(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
508 |
"""Returns a list of (vfs, path) for files to undo transactions.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
509 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
510 |
def recover(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
511 |
"""Roll back an interrupted transaction.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
512 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
513 |
def rollback(dryrun=False, force=False): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
514 |
"""Undo the last transaction. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
515 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
516 |
DANGEROUS. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
517 |
""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
518 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
519 |
def updatecaches(tr=None, full=False): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
520 |
"""Warm repo caches.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
521 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
522 |
def invalidatecaches(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
523 |
"""Invalidate cached data due to the repository mutating.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
524 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
525 |
def invalidatevolatilesets(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
526 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
527 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
528 |
def invalidatedirstate(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
529 |
"""Invalidate the dirstate.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
530 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
531 |
def invalidate(clearfilecache=False): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
532 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
533 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
534 |
def invalidateall(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
535 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
536 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
537 |
def lock(wait=True): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
538 |
"""Lock the repository store and return a lock instance.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
539 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
540 |
def wlock(wait=True): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
541 |
"""Lock the non-store parts of the repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
542 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
543 |
def currentwlock(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
544 |
"""Return the wlock if it's held or None.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
545 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
546 |
def checkcommitpatterns(wctx, vdirs, match, status, fail): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
547 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
548 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
549 |
def commit(text='', user=None, date=None, match=None, force=False, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
550 |
editor=False, extra=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
551 |
"""Add a new revision to the repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
552 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
553 |
def commitctx(ctx, error=False): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
554 |
"""Commit a commitctx instance to the repository.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
555 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
556 |
def destroying(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
557 |
"""Inform the repository that nodes are about to be destroyed.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
558 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
559 |
def destroyed(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
560 |
"""Inform the repository that nodes have been destroyed.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
561 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
562 |
def status(node1='.', node2=None, match=None, ignored=False, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
563 |
clean=False, unknown=False, listsubrepos=False): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
564 |
"""Convenience method to call repo[x].status().""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
565 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
566 |
def addpostdsstatus(ps): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
567 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
568 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
569 |
def postdsstatus(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
570 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
571 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
572 |
def clearpostdsstatus(): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
573 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
574 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
575 |
def heads(start=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
576 |
"""Obtain list of nodes that are DAG heads.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
577 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
578 |
def branchheads(branch=None, start=None, closed=False): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
579 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
580 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
581 |
def branches(nodes): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
582 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
583 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
584 |
def between(pairs): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
585 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
586 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
587 |
def checkpush(pushop): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
588 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
589 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
590 |
prepushoutgoinghooks = zi.Attribute( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
591 |
"""util.hooks instance.""") |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
592 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
593 |
def pushkey(namespace, key, old, new): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
594 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
595 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
596 |
def listkeys(namespace): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
597 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
598 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
599 |
def debugwireargs(one, two, three=None, four=None, five=None): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
600 |
pass |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
601 |
|
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
602 |
def savecommitmessage(text): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33802
diff
changeset
|
603 |
pass |