1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 """PyArch exceptions
20 """
21
22
24
26 info = [ proc.command ]
27 status = []
28 if proc.signal is not None:
29 status.append("got signal %d" % proc.signal)
30 if proc.status is not None:
31 status.append("exited with code %d" % proc.status)
32 info.append(",".join(status))
33 if proc.status is not None:
34 codes = ' '.join(map(str, proc.expected))
35 if len(proc.expected) == 1:
36 info.append("(expected exit code %s)" % codes)
37 else:
38 info.append("(expected exit codes %s)" % codes)
39 lines = [' '.join(info)]
40 if proc.args: lines.append('argv: ' + ", ".join(map(repr, proc.args)))
41 if proc.chdir: lines.append('chdir: ' + repr(proc.chdir))
42 if proc.error is not None:
43 error = proc.error.rstrip()
44 else:
45 error = None
46 if error: lines.extend(("* error report", error))
47 RuntimeError.__init__(self, '\n'.join(lines))
48 self.proc = proc
49
50
52
53 """Tried to create a source tree object from non-tree-root directory."""
54
59
60
62
63 """Could not find the Arch tree-root of a directory."""
64
69
70
72
73 """Arch source tree does not have a valid default version."""
74
75 - def __init__(self, tree, bad_version=None):
76 if bad_version is None:
77 message = "tree has no default version set: %r" % (tree,)
78 else:
79 message = "invalid default version for tree: tree=%r, version=%r" \
80 % (tree, bad_version)
81 Exception.__init__(self, message)
82 self.tree = tree
83 self.bad_version = bad_version
84
85
87
88 """Invalid Arch namespace name, or incorrect kind of name.
89
90 A value that does not make sense in the Arch namespace was
91 provided, or the wrong kind of name was used, for example a
92 revision where a patchlevel is expected.
93 """
94
95 - def __init__(self, name, expected=None):
96 if expected is None:
97 message = "invalid name: %s" % (name,)
98 else:
99 message = "invalid %s: %s" % (expected, name)
100 Exception.__init__(self, message)
101 self.name = name
102 self.expected = expected
103
104
106 """Tried to access an unregistered archive.
107
108 Namespace existence predicates, implementing `NamespaceObject.exists`,
109 return a boolean value for the existence of a name in the Arch namespace.
110 When the archive a name belongs to is not registered, existence cannot be
111 decided, so this exception is raised.
112 """
113
115 message = "archive not registered: %s" % (name,)
116 Exception.__init__(self, message)
117 self.name = name
118
119
121 """Tried to unregister a location that is not registered.
122
123 `ArchiveLocation.unregister` raises this exception if the location was not
124 registered.
125 """
126
128 message = "location not registered: %s" % (url,)
129 Exception.__init__(self, message)
130 self.url = url
131
132
134 """Tried to register a location that was already registered.
135
136 `ArchiveLocation.register` raises this exception if the location was
137 already registered.
138 """
139
141 message = "location already registered: %s" % (url,)
142 Exception.__init__(self, message)
143 self.url = url
144
145
147 """Tried to mirror to a location that contains a different archive.
148
149 `ArchiveLocation.make_mirrorer` raises this exception if the target was a
150 registered location for a different archive.
151 """
152
154 message = ("source location %r contains archive %r,"
155 " but target location %r contains archive %r."
156 % (source, source.archive(), target, target.archive()))
157 Exception.__init__(self, message)
158 self.source = source
159 self.target = target
160
161
174
175
177 """Tried to get the id-tag of file which has none.
178
179 The id-tag of a file is an id which is set by an explicit id or a
180 tagline. Implicit-style taglines ("tag:") and name-based ids do
181 not count.
182 """
183
185 message = "file has not explicit id nor tagline: %s" % (name,)
186 Exception.__init__(self, message)
187 self.name = name
188
190 """Illegal syntax in a pika-escaped string.
191
192 Pika-escaping is the syntax used to represent spaces, control
193 characters and non-ASCII characters in file names with Arch.
194 """
195
197 message = "illegal escape sequence in %r" % text
198 Exception.__init__(self, message)
199 self.text = text
200
201
203
204 """Failed to find a pristine for the given revision.
205
206 `WorkingTree.find_pristine` raises this exception if no pristine
207 tree can be found for the given revision.
208 """
209
215
216
218
219 """A request file is not present in the given revision.
220
221 `ArchSourceTree.file_find` raises this exception if the requested
222 does not exist in the specified revision.
223 """
224
225 - def __init__(self, tree, name, revision):
230
231
233
234 """A conflict occured when applying a changeset."""
235
240