Merge lp:~jelmer/brz/google-docstrings-2 into lp:brz
- google-docstrings-2
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Superseded |
---|---|
Proposed branch: | lp:~jelmer/brz/google-docstrings-2 |
Merge into: | lp:brz |
Prerequisite: | lp:~jelmer/brz/google-docstrings-1 |
Diff against target: |
2147 lines (+517/-379) 9 files modified
breezy/branch.py (+181/-146) breezy/bzr/fetch.py (+32/-30) breezy/bzr/groupcompress.py (+10/-10) breezy/commands.py (+71/-40) breezy/filters/__init__.py (+32/-19) breezy/option.py (+24/-25) breezy/plugin.py (+28/-14) breezy/repository.py (+138/-94) breezy/workingtree.py (+1/-1) |
To merge this branch: | bzr merge lp:~jelmer/brz/google-docstrings-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+426599@code.launchpad.net |
This proposal has been superseded by a proposal from 2022-10-30.
Commit message
Use more google docstrings.
Description of the change
Use more google docstrings.
To post a comment you must log in.
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
- 7600. By Jelmer Vernooij
-
Merge lp:brz/3.3
- 7601. By Jelmer Vernooij
-
Convert breezy.tree.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/branch.py' |
2 | --- breezy/branch.py 2021-12-25 15:36:32 +0000 |
3 | +++ breezy/branch.py 2022-07-09 22:09:46 +0000 |
4 | @@ -14,6 +14,8 @@ |
5 | # along with this program; if not, write to the Free Software |
6 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
7 | |
8 | +__docformat__ = "google" |
9 | + |
10 | from typing import Optional, Tuple |
11 | |
12 | from .lazy_import import lazy_import |
13 | @@ -74,8 +76,9 @@ |
14 | class Branch(controldir.ControlComponent): |
15 | """Branch holding a history of revisions. |
16 | |
17 | - :ivar hooks: An instance of BranchHooks. |
18 | - :ivar _master_branch_cache: cached result of get_master_branch, see |
19 | + Attributes: |
20 | + hooks: An instance of BranchHooks. |
21 | + _master_branch_cache: cached result of get_master_branch, see |
22 | _clear_cached_state. |
23 | """ |
24 | |
25 | @@ -149,9 +152,10 @@ |
26 | encountered. Otherwise, stop when the beginning of history is |
27 | reached. |
28 | |
29 | - :param stop_index: The index which should be present. When it is |
30 | + Args: |
31 | + stop_index: The index which should be present. When it is |
32 | present, history extension will stop. |
33 | - :param stop_revision: The revision id which should be present. When |
34 | + stop_revision: The revision id which should be present. When |
35 | it is encountered, history extension will stop. |
36 | """ |
37 | if len(self._partial_revision_history_cache) == 0: |
38 | @@ -227,7 +231,7 @@ |
39 | This can then be used to get and set configuration options for the |
40 | branch. |
41 | |
42 | - :return: A breezy.config.BranchConfig. |
43 | + Returns: A breezy.config.BranchConfig. |
44 | """ |
45 | return _mod_config.BranchConfig(self) |
46 | |
47 | @@ -237,14 +241,15 @@ |
48 | This can then be used to get and set configuration options for the |
49 | branch. |
50 | |
51 | - :return: A breezy.config.BranchStack. |
52 | + Returns: A breezy.config.BranchStack. |
53 | """ |
54 | return _mod_config.BranchStack(self) |
55 | |
56 | def store_uncommitted(self, creator): |
57 | """Store uncommitted changes from a ShelfCreator. |
58 | |
59 | - :param creator: The ShelfCreator containing uncommitted changes, or |
60 | + Args: |
61 | + creator: The ShelfCreator containing uncommitted changes, or |
62 | None to delete any stored changes. |
63 | :raises: ChangesAlreadyStored if the branch already has changes. |
64 | """ |
65 | @@ -253,8 +258,9 @@ |
66 | def get_unshelver(self, tree): |
67 | """Return a shelf.Unshelver for this branch and tree. |
68 | |
69 | - :param tree: The tree to use to construct the Unshelver. |
70 | - :return: an Unshelver or None if no changes are stored. |
71 | + Args: |
72 | + tree: The tree to use to construct the Unshelver. |
73 | + Returns: an Unshelver or None if no changes are stored. |
74 | """ |
75 | raise NotImplementedError(self.get_unshelver) |
76 | |
77 | @@ -322,16 +328,16 @@ |
78 | def lock_write(self, token=None): |
79 | """Lock the branch for write operations. |
80 | |
81 | - :param token: A token to permit reacquiring a previously held and |
82 | + token: A token to permit reacquiring a previously held and |
83 | preserved lock. |
84 | - :return: A BranchWriteLockResult. |
85 | + Returns: A BranchWriteLockResult. |
86 | """ |
87 | raise NotImplementedError(self.lock_write) |
88 | |
89 | def lock_read(self): |
90 | """Lock the branch for read operations. |
91 | |
92 | - :return: A breezy.lock.LogicalLockResult. |
93 | + Returns: A breezy.lock.LogicalLockResult. |
94 | """ |
95 | raise NotImplementedError(self.lock_read) |
96 | |
97 | @@ -348,12 +354,13 @@ |
98 | def dotted_revno_to_revision_id(self, revno, _cache_reverse=False): |
99 | """Return the revision_id for a dotted revno. |
100 | |
101 | - :param revno: a tuple like (1,) or (1,1,2) |
102 | - :param _cache_reverse: a private parameter enabling storage |
103 | + Args: |
104 | + revno: a tuple like (1,) or (1,1,2) |
105 | + _cache_reverse: a private parameter enabling storage |
106 | of the reverse mapping in a top level cache. (This should |
107 | only be done in selective circumstances as we want to |
108 | avoid having the mapping cached multiple times.) |
109 | - :return: the revision_id |
110 | + Returns: the revision_id |
111 | :raises errors.NoSuchRevision: if the revno doesn't exist |
112 | """ |
113 | with self.lock_read(): |
114 | @@ -386,7 +393,7 @@ |
115 | def revision_id_to_dotted_revno(self, revision_id): |
116 | """Given a revision id, return its dotted revno. |
117 | |
118 | - :return: a tuple like (1,) or (400,1,3). |
119 | + Returns: a tuple like (1,) or (400,1,3). |
120 | """ |
121 | with self.lock_read(): |
122 | return self._do_revision_id_to_dotted_revno(revision_id) |
123 | @@ -417,7 +424,7 @@ |
124 | |
125 | This will be regenerated on demand, but will be cached. |
126 | |
127 | - :return: A dictionary mapping revision_id => dotted revno. |
128 | + Returns: A dictionary mapping revision_id => dotted revno. |
129 | This dictionary should not be modified by the caller. |
130 | """ |
131 | if 'evil' in debug.debug_flags: |
132 | @@ -443,7 +450,7 @@ |
133 | This is the worker function for get_revision_id_to_revno_map, which |
134 | just caches the return value. |
135 | |
136 | - :return: A dictionary mapping revision_id => dotted revno. |
137 | + Returns: A dictionary mapping revision_id => dotted revno. |
138 | """ |
139 | revision_id_to_revno = { |
140 | rev_id: revno for rev_id, depth, revno, end_of_merge |
141 | @@ -459,11 +466,12 @@ |
142 | topological sort, i.e. all parents come before their |
143 | children going forward; the opposite for reverse. |
144 | |
145 | - :param start_revision_id: the revision_id to begin walking from. |
146 | + Args: |
147 | + start_revision_id: the revision_id to begin walking from. |
148 | If None, the branch tip is used. |
149 | - :param stop_revision_id: the revision_id to terminate the walk |
150 | + stop_revision_id: the revision_id to terminate the walk |
151 | after. If None, the rest of history is included. |
152 | - :param stop_rule: if stop_revision_id is not None, the precise rule |
153 | + stop_rule: if stop_revision_id is not None, the precise rule |
154 | to use for termination: |
155 | |
156 | * 'exclude' - leave the stop revision out of the result (default) |
157 | @@ -472,7 +480,7 @@ |
158 | merged revisions in the result |
159 | * 'with-merges-without-common-ancestry' - filter out revisions |
160 | that are in both ancestries |
161 | - :param direction: either 'reverse' or 'forward': |
162 | + direction: either 'reverse' or 'forward': |
163 | |
164 | * reverse means return the start_revision_id first, i.e. |
165 | start at the most recent revision and go backwards in history |
166 | @@ -481,7 +489,7 @@ |
167 | ordering w.r.t. depth as some clients of this API may like. |
168 | (If required, that ought to be done at higher layers.) |
169 | |
170 | - :return: an iterator over (revision_id, depth, revno, end_of_merge) |
171 | + Returns: an iterator over (revision_id, depth, revno, end_of_merge) |
172 | tuples where: |
173 | |
174 | * revision_id: the unique id of the revision |
175 | @@ -663,8 +671,8 @@ |
176 | def bind(self, other): |
177 | """Bind the local branch the other branch. |
178 | |
179 | - :param other: The branch to bind to |
180 | - :type other: Branch |
181 | + Args: |
182 | + other: The branch to bind to |
183 | """ |
184 | raise BindingUnsupported(self) |
185 | |
186 | @@ -683,11 +691,12 @@ |
187 | def fetch(self, from_branch, stop_revision=None, limit=None, lossy=False): |
188 | """Copy revisions from from_branch into this branch. |
189 | |
190 | - :param from_branch: Where to copy from. |
191 | - :param stop_revision: What revision to stop at (None for at the end |
192 | + Args: |
193 | + from_branch: Where to copy from. |
194 | + stop_revision: What revision to stop at (None for at the end |
195 | of the branch. |
196 | - :param limit: Optional rough limit of revisions to fetch |
197 | - :return: None |
198 | + limit: Optional rough limit of revisions to fetch |
199 | + Returns: None |
200 | """ |
201 | with self.lock_write(): |
202 | return InterBranch.get(from_branch, self).fetch( |
203 | @@ -711,14 +720,15 @@ |
204 | revision_id=None, lossy=False): |
205 | """Obtain a CommitBuilder for this branch. |
206 | |
207 | - :param parents: Revision ids of the parents of the new revision. |
208 | - :param config: Optional configuration to use. |
209 | - :param timestamp: Optional timestamp recorded for commit. |
210 | - :param timezone: Optional timezone for timestamp. |
211 | - :param committer: Optional committer to set for commit. |
212 | - :param revprops: Optional dictionary of revision properties. |
213 | - :param revision_id: Optional revision id. |
214 | - :param lossy: Whether to discard data that can not be natively |
215 | + Args: |
216 | + parents: Revision ids of the parents of the new revision. |
217 | + config: Optional configuration to use. |
218 | + timestamp: Optional timestamp recorded for commit. |
219 | + timezone: Optional timezone for timestamp. |
220 | + committer: Optional committer to set for commit. |
221 | + revprops: Optional dictionary of revision properties. |
222 | + revision_id: Optional revision id. |
223 | + lossy: Whether to discard data that can not be natively |
224 | represented, when pushing to a foreign VCS |
225 | """ |
226 | |
227 | @@ -732,7 +742,7 @@ |
228 | def get_master_branch(self, possible_transports=None): |
229 | """Return the branch we are bound to. |
230 | |
231 | - :return: Either a Branch, or None |
232 | + Returns: Either a Branch, or None |
233 | """ |
234 | return None |
235 | |
236 | @@ -989,7 +999,7 @@ |
237 | def last_revision_info(self) -> Tuple[int, RevisionID]: |
238 | """Return information about the last revision. |
239 | |
240 | - :return: A tuple (revno, revision_id). |
241 | + Returns: A tuple (revno, revision_id). |
242 | """ |
243 | with self.lock_read(): |
244 | if self._last_revision_info_cache is None: |
245 | @@ -1008,12 +1018,13 @@ |
246 | the master branch first before updating the tip of the local branch. |
247 | Revisions referenced by source's tags are also transferred. |
248 | |
249 | - :param source: Source branch to optionally fetch from |
250 | - :param revno: Revision number of the new tip |
251 | - :param revid: Revision id of the new tip |
252 | - :param lossy: Whether to discard metadata that can not be |
253 | + Args: |
254 | + source: Source branch to optionally fetch from |
255 | + revno: Revision number of the new tip |
256 | + revid: Revision id of the new tip |
257 | + lossy: Whether to discard metadata that can not be |
258 | natively represented |
259 | - :return: Tuple with the new revision number and revision id |
260 | + Returns: Tuple with the new revision number and revision id |
261 | (should only be different from the arguments when lossy=True) |
262 | """ |
263 | if not self.repository.has_same_location(source.repository): |
264 | @@ -1052,7 +1063,7 @@ |
265 | |
266 | This branch is considered to be 'local', having low latency. |
267 | |
268 | - :returns: PullResult instance |
269 | + Returns: PullResult instance |
270 | """ |
271 | return InterBranch.get(source, self).pull( |
272 | overwrite=overwrite, stop_revision=stop_revision, |
273 | @@ -1182,7 +1193,7 @@ |
274 | def update(self): |
275 | """Synchronise this branch with the master branch if any. |
276 | |
277 | - :return: None or the last_revision pivoted out during the update. |
278 | + Returns: None or the last_revision pivoted out during the update. |
279 | """ |
280 | return None |
281 | |
282 | @@ -1255,9 +1266,10 @@ |
283 | repository contains all the lefthand ancestors of the intended |
284 | last_revision. If not, set_last_revision_info will fail. |
285 | |
286 | - :param destination: The branch to copy the history into |
287 | - :param revision_id: The revision-id to truncate history at. May |
288 | - be None to copy complete history. |
289 | + Args: |
290 | + destination: The branch to copy the history into |
291 | + revision_id: The revision-id to truncate history at. May |
292 | + be None to copy complete history. |
293 | """ |
294 | source_revno, source_revision_id = self.last_revision_info() |
295 | if revision_id is None: |
296 | @@ -1297,9 +1309,10 @@ |
297 | |
298 | Callers will typically also want to check the repository. |
299 | |
300 | - :param refs: Calculated refs for this branch as specified by |
301 | + Args: |
302 | + refs: Calculated refs for this branch as specified by |
303 | branch._get_check_refs() |
304 | - :return: A BranchCheckResult. |
305 | + Returns: A BranchCheckResult. |
306 | """ |
307 | with self.lock_read(): |
308 | result = BranchCheckResult(self) |
309 | @@ -1330,13 +1343,14 @@ |
310 | tag_selector=None): |
311 | """Create a clone of this branch and its bzrdir. |
312 | |
313 | - :param to_transport: The transport to clone onto. |
314 | - :param revision_id: The revision id to use as tip in the new branch. |
315 | + Args: |
316 | + to_transport: The transport to clone onto. |
317 | + revision_id: The revision id to use as tip in the new branch. |
318 | If None the tip is obtained from this branch. |
319 | - :param stacked_on: An optional URL to stack the clone on. |
320 | - :param create_prefix: Create any missing directories leading up to |
321 | + stacked_on: An optional URL to stack the clone on. |
322 | + create_prefix: Create any missing directories leading up to |
323 | to_transport. |
324 | - :param use_existing_dir: Use an existing directory if one exists. |
325 | + use_existing_dir: Use an existing directory if one exists. |
326 | """ |
327 | # XXX: Fix the bzrdir API to allow getting the branch back from the |
328 | # clone call. Or something. 20090224 RBC/spiv. |
329 | @@ -1355,18 +1369,19 @@ |
330 | hardlink=False, recurse_nested=True): |
331 | """Create a checkout of a branch. |
332 | |
333 | - :param to_location: The url to produce the checkout at |
334 | - :param revision_id: The revision to check out |
335 | - :param lightweight: If True, produce a lightweight checkout, otherwise, |
336 | + Args: |
337 | + to_location: The url to produce the checkout at |
338 | + revision_id: The revision to check out |
339 | + lightweight: If True, produce a lightweight checkout, otherwise, |
340 | produce a bound branch (heavyweight checkout) |
341 | - :param accelerator_tree: A tree which can be used for retrieving file |
342 | + accelerator_tree: A tree which can be used for retrieving file |
343 | contents more quickly than the revision tree, i.e. a workingtree. |
344 | The revision tree will be used for cases where accelerator_tree's |
345 | content is different. |
346 | - :param hardlink: If true, hard-link files from accelerator_tree, |
347 | + hardlink: If true, hard-link files from accelerator_tree, |
348 | where possible. |
349 | - :param recurse_nested: Whether to recurse into nested trees |
350 | - :return: The tree of the created checkout |
351 | + recurse_nested: Whether to recurse into nested trees |
352 | + Returns: The tree of the created checkout |
353 | """ |
354 | t = transport.get_transport(to_location) |
355 | t.ensure_base() |
356 | @@ -1419,7 +1434,7 @@ |
357 | def reconcile(self, thorough=True): |
358 | """Make sure the data stored in this branch is consistent. |
359 | |
360 | - :return: A `ReconcileResult` object. |
361 | + Returns: A `ReconcileResult` object. |
362 | """ |
363 | raise NotImplementedError(self.reconcile) |
364 | |
365 | @@ -1429,8 +1444,9 @@ |
366 | def automatic_tag_name(self, revision_id): |
367 | """Try to automatically find the tag name for a revision. |
368 | |
369 | - :param revision_id: Revision id of the revision. |
370 | - :return: A tag name or None if no tag name could be determined. |
371 | + Args: |
372 | + revision_id: Revision id of the revision. |
373 | + Returns: A tag name or None if no tag name could be determined. |
374 | """ |
375 | for hook in Branch.hooks['automatic_tag_name']: |
376 | ret = hook(self, revision_id) |
377 | @@ -1445,7 +1461,7 @@ |
378 | This is a helper function for update_revisions. |
379 | |
380 | :raises: DivergedBranches if revision_b has diverged from revision_a. |
381 | - :returns: True if revision_b is a descendant of revision_a. |
382 | + Returns: True if revision_b is a descendant of revision_a. |
383 | """ |
384 | relation = self._revision_relations(revision_a, revision_b, graph) |
385 | if relation == 'b_descends_from_a': |
386 | @@ -1460,7 +1476,7 @@ |
387 | def _revision_relations(self, revision_a, revision_b, graph): |
388 | """Determine the relationship between two revisions. |
389 | |
390 | - :returns: One of: 'a_descends_from_b', 'b_descends_from_a', 'diverged' |
391 | + Returns: One of: 'a_descends_from_b', 'b_descends_from_a', 'diverged' |
392 | """ |
393 | heads = graph.heads([revision_a, revision_b]) |
394 | if heads == {revision_b}: |
395 | @@ -1477,7 +1493,7 @@ |
396 | """Return the heads that must and that should be fetched to copy this |
397 | branch into another repo. |
398 | |
399 | - :returns: a 2-tuple of (must_fetch, if_present_fetch). must_fetch is a |
400 | + Returns: a 2-tuple of (must_fetch, if_present_fetch). must_fetch is a |
401 | set of heads that must be fetched. if_present_fetch is a set of |
402 | heads that must be fetched if present, but no error is necessary if |
403 | they are not present. |
404 | @@ -1498,7 +1514,7 @@ |
405 | def create_memorytree(self): |
406 | """Create a memory tree for this branch. |
407 | |
408 | - :return: An in-memory MutableTree instance |
409 | + Returns: An in-memory MutableTree instance |
410 | """ |
411 | from . import memorytree |
412 | return memorytree.MemoryTree.create_on_branch(self) |
413 | @@ -1535,9 +1551,10 @@ |
414 | this method - it is assumed that the format of the branch |
415 | in controldir is correct. |
416 | |
417 | - :param controldir: The controldir to get the branch data from. |
418 | - :param name: Name of the colocated branch to fetch |
419 | - :return: None if the branch is not a reference branch. |
420 | + Args: |
421 | + controldir: The controldir to get the branch data from. |
422 | + name: Name of the colocated branch to fetch |
423 | + Returns: None if the branch is not a reference branch. |
424 | """ |
425 | return None |
426 | |
427 | @@ -1549,9 +1566,10 @@ |
428 | this method - it is assumed that the format of the branch |
429 | in controldir is correct. |
430 | |
431 | - :param controldir: The controldir to set the branch reference for. |
432 | - :param name: Name of colocated branch to set, None for default |
433 | - :param to_branch: branch that the checkout is to reference |
434 | + Args: |
435 | + controldir: The controldir to set the branch reference for. |
436 | + name: Name of colocated branch to set, None for default |
437 | + to_branch: branch that the checkout is to reference |
438 | """ |
439 | raise NotImplementedError(self.set_reference) |
440 | |
441 | @@ -1571,7 +1589,8 @@ |
442 | append_revisions_only=None): |
443 | """Create a branch of this format in controldir. |
444 | |
445 | - :param name: Name of the colocated branch to create. |
446 | + Args: |
447 | + name: Name of the colocated branch to create. |
448 | """ |
449 | raise NotImplementedError(self.initialize) |
450 | |
451 | @@ -1613,11 +1632,12 @@ |
452 | found_repository=None, possible_transports=None): |
453 | """Return the branch object for controldir. |
454 | |
455 | - :param controldir: A ControlDir that contains a branch. |
456 | - :param name: Name of colocated branch to open |
457 | - :param _found: a private parameter, do not use it. It is used to |
458 | + Args: |
459 | + controldir: A ControlDir that contains a branch. |
460 | + name: Name of colocated branch to open |
461 | + _found: a private parameter, do not use it. It is used to |
462 | indicate if format probing has already be done. |
463 | - :param ignore_fallbacks: when set, no fallback branches will be opened |
464 | + ignore_fallbacks: when set, no fallback branches will be opened |
465 | (if there are any). Default is to open fallbacks. |
466 | """ |
467 | raise NotImplementedError(self.open) |
468 | @@ -1765,11 +1785,12 @@ |
469 | |
470 | There are 5 fields that hooks may wish to access: |
471 | |
472 | - :ivar branch: the branch being changed |
473 | - :ivar old_revno: revision number before the change |
474 | - :ivar new_revno: revision number after the change |
475 | - :ivar old_revid: revision id before the change |
476 | - :ivar new_revid: revision id after the change |
477 | + Attributes: |
478 | + branch: the branch being changed |
479 | + old_revno: revision number before the change |
480 | + new_revno: revision number after the change |
481 | + old_revid: revision id before the change |
482 | + new_revid: revision id after the change |
483 | |
484 | The revid fields are strings. The revno fields are integers. |
485 | """ |
486 | @@ -1777,11 +1798,12 @@ |
487 | def __init__(self, branch, old_revno, new_revno, old_revid, new_revid): |
488 | """Create a group of ChangeBranchTip parameters. |
489 | |
490 | - :param branch: The branch being changed. |
491 | - :param old_revno: Revision number before the change. |
492 | - :param new_revno: Revision number after the change. |
493 | - :param old_revid: Tip revision id before the change. |
494 | - :param new_revid: Tip revision id after the change. |
495 | + Args: |
496 | + branch: The branch being changed. |
497 | + old_revno: Revision number before the change. |
498 | + new_revno: Revision number after the change. |
499 | + old_revid: Tip revision id before the change. |
500 | + new_revid: Tip revision id after the change. |
501 | """ |
502 | self.branch = branch |
503 | self.old_revno = old_revno |
504 | @@ -1803,10 +1825,11 @@ |
505 | |
506 | There are 4 fields that hooks may wish to access: |
507 | |
508 | - :ivar format: the branch format |
509 | - :ivar bzrdir: the ControlDir where the branch will be/has been initialized |
510 | - :ivar name: name of colocated branch, if any (or None) |
511 | - :ivar branch: the branch created |
512 | + Attributes: |
513 | + format: the branch format |
514 | + bzrdir: the ControlDir where the branch will be/has been initialized |
515 | + name: name of colocated branch, if any (or None) |
516 | + branch: the branch created |
517 | |
518 | Note that for lightweight checkouts, the bzrdir and format fields refer to |
519 | the checkout, hence they are different from the corresponding fields in |
520 | @@ -1816,11 +1839,12 @@ |
521 | def __init__(self, format, controldir, name, branch): |
522 | """Create a group of BranchInitHook parameters. |
523 | |
524 | - :param format: the branch format |
525 | - :param controldir: the ControlDir where the branch will be/has been |
526 | + Args: |
527 | + format: the branch format |
528 | + controldir: the ControlDir where the branch will be/has been |
529 | initialized |
530 | - :param name: name of colocated branch, if any (or None) |
531 | - :param branch: the branch created |
532 | + name: name of colocated branch, if any (or None) |
533 | + branch: the branch created |
534 | |
535 | Note that for lightweight checkouts, the bzrdir and format fields refer |
536 | to the checkout, hence they are different from the corresponding fields |
537 | @@ -1843,19 +1867,21 @@ |
538 | |
539 | There are 4 fields that hooks may wish to access: |
540 | |
541 | - :ivar control_dir: ControlDir of the checkout to change |
542 | - :ivar to_branch: branch that the checkout is to reference |
543 | - :ivar force: skip the check for local commits in a heavy checkout |
544 | - :ivar revision_id: revision ID to switch to (or None) |
545 | + Attributes: |
546 | + control_dir: ControlDir of the checkout to change |
547 | + to_branch: branch that the checkout is to reference |
548 | + force: skip the check for local commits in a heavy checkout |
549 | + revision_id: revision ID to switch to (or None) |
550 | """ |
551 | |
552 | def __init__(self, control_dir, to_branch, force, revision_id): |
553 | """Create a group of SwitchHook parameters. |
554 | |
555 | - :param control_dir: ControlDir of the checkout to change |
556 | - :param to_branch: branch that the checkout is to reference |
557 | - :param force: skip the check for local commits in a heavy checkout |
558 | - :param revision_id: revision ID to switch to (or None) |
559 | + Args: |
560 | + control_dir: ControlDir of the checkout to change |
561 | + to_branch: branch that the checkout is to reference |
562 | + force: skip the check for local commits in a heavy checkout |
563 | + revision_id: revision ID to switch to (or None) |
564 | """ |
565 | self.control_dir = control_dir |
566 | self.to_branch = to_branch |
567 | @@ -1932,9 +1958,10 @@ |
568 | class BranchWriteLockResult(LogicalLockResult): |
569 | """The result of write locking a branch. |
570 | |
571 | - :ivar token: The token obtained from the underlying branch lock, or |
572 | + Attributes: |
573 | + token: The token obtained from the underlying branch lock, or |
574 | None. |
575 | - :ivar unlock: A callable which will unlock the lock. |
576 | + unlock: A callable which will unlock the lock. |
577 | """ |
578 | |
579 | def __repr__(self): |
580 | @@ -1958,17 +1985,18 @@ |
581 | class PullResult(_Result): |
582 | """Result of a Branch.pull operation. |
583 | |
584 | - :ivar old_revno: Revision number before pull. |
585 | - :ivar new_revno: Revision number after pull. |
586 | - :ivar old_revid: Tip revision id before pull. |
587 | - :ivar new_revid: Tip revision id after pull. |
588 | - :ivar source_branch: Source (local) branch object. (read locked) |
589 | - :ivar master_branch: Master branch of the target, or the target if no |
590 | + Attributes: |
591 | + old_revno: Revision number before pull. |
592 | + new_revno: Revision number after pull. |
593 | + old_revid: Tip revision id before pull. |
594 | + new_revid: Tip revision id after pull. |
595 | + source_branch: Source (local) branch object. (read locked) |
596 | + master_branch: Master branch of the target, or the target if no |
597 | Master |
598 | - :ivar local_branch: target branch if there is a Master, else None |
599 | - :ivar target_branch: Target/destination branch object. (write locked) |
600 | - :ivar tag_conflicts: A list of tag conflicts, see BasicTags.merge_to |
601 | - :ivar tag_updates: A dict with new tags, see BasicTags.merge_to |
602 | + local_branch: target branch if there is a Master, else None |
603 | + target_branch: Target/destination branch object. (write locked) |
604 | + tag_conflicts: A list of tag conflicts, see BasicTags.merge_to |
605 | + tag_updates: A dict with new tags, see BasicTags.merge_to |
606 | """ |
607 | |
608 | def report(self, to_file): |
609 | @@ -1990,19 +2018,20 @@ |
610 | class BranchPushResult(_Result): |
611 | """Result of a Branch.push operation. |
612 | |
613 | - :ivar old_revno: Revision number (eg 10) of the target before push. |
614 | - :ivar new_revno: Revision number (eg 12) of the target after push. |
615 | - :ivar old_revid: Tip revision id (eg joe@foo.com-1234234-aoeua34) of target |
616 | + Attributes: |
617 | + old_revno: Revision number (eg 10) of the target before push. |
618 | + new_revno: Revision number (eg 12) of the target after push. |
619 | + old_revid: Tip revision id (eg joe@foo.com-1234234-aoeua34) of target |
620 | before the push. |
621 | - :ivar new_revid: Tip revision id (eg joe@foo.com-5676566-boa234a) of target |
622 | + new_revid: Tip revision id (eg joe@foo.com-5676566-boa234a) of target |
623 | after the push. |
624 | - :ivar source_branch: Source branch object that the push was from. This is |
625 | + source_branch: Source branch object that the push was from. This is |
626 | read locked, and generally is a local (and thus low latency) branch. |
627 | - :ivar master_branch: If target is a bound branch, the master branch of |
628 | + master_branch: If target is a bound branch, the master branch of |
629 | target, or target itself. Always write locked. |
630 | - :ivar target_branch: The direct Branch where data is being sent (write |
631 | + target_branch: The direct Branch where data is being sent (write |
632 | locked). |
633 | - :ivar local_branch: If the target is a bound branch this will be the |
634 | + local_branch: If the target is a bound branch this will be the |
635 | target, otherwise it will be None. |
636 | """ |
637 | |
638 | @@ -2035,7 +2064,7 @@ |
639 | class BranchCheckResult(object): |
640 | """Results of checking branch consistency. |
641 | |
642 | - :see: Branch.check |
643 | + See `Branch.check` |
644 | """ |
645 | |
646 | def __init__(self, branch): |
647 | @@ -2045,7 +2074,8 @@ |
648 | def report_results(self, verbose): |
649 | """Report the check results via trace.note. |
650 | |
651 | - :param verbose: Requests more detailed display of what was checked, |
652 | + Args: |
653 | + verbose: Requests more detailed display of what was checked, |
654 | if any. |
655 | """ |
656 | note(gettext('checked branch {0} format {1}').format( |
657 | @@ -2069,7 +2099,7 @@ |
658 | def _get_branch_formats_to_test(klass): |
659 | """Return an iterable of format tuples for testing. |
660 | |
661 | - :return: An iterable of (from_format, to_format) to use when testing |
662 | + Returns: An iterable of (from_format, to_format) to use when testing |
663 | this InterBranch class. Each InterBranch class should define this |
664 | method itself. |
665 | """ |
666 | @@ -2081,7 +2111,7 @@ |
667 | |
668 | The target branch is considered to be 'local', having low latency. |
669 | |
670 | - :returns: PullResult instance |
671 | + Returns: PullResult instance |
672 | """ |
673 | raise NotImplementedError(self.pull) |
674 | |
675 | @@ -2096,10 +2126,11 @@ |
676 | def copy_content_into(self, revision_id=None, tag_selector=None): |
677 | """Copy the content of source into target |
678 | |
679 | - :param revision_id: |
680 | + Args: |
681 | + revision_id: |
682 | if not None, the revision history in the new branch will |
683 | be truncated to end with revision_id. |
684 | - :param tag_selector: Optional callback that can decide |
685 | + tag_selector: Optional callback that can decide |
686 | to copy or not copy tags. |
687 | """ |
688 | raise NotImplementedError(self.copy_content_into) |
689 | @@ -2107,9 +2138,10 @@ |
690 | def fetch(self, stop_revision=None, limit=None, lossy=False): |
691 | """Fetch revisions. |
692 | |
693 | - :param stop_revision: Last revision to fetch |
694 | - :param limit: Optional rough limit of revisions to fetch |
695 | - :return: FetchResult object |
696 | + Args: |
697 | + stop_revision: Last revision to fetch |
698 | + limit: Optional rough limit of revisions to fetch |
699 | + Returns: FetchResult object |
700 | """ |
701 | raise NotImplementedError(self.fetch) |
702 | |
703 | @@ -2229,7 +2261,8 @@ |
704 | tag_selector=None): |
705 | """Pull from source into self, updating my master if any. |
706 | |
707 | - :param run_hooks: Private parameter - if false, this branch |
708 | + Args: |
709 | + run_hooks: Private parameter - if false, this branch |
710 | is being called because it's the master of the primary branch, |
711 | so it should not run its hooks. |
712 | """ |
713 | @@ -2272,7 +2305,8 @@ |
714 | |
715 | This is the basic concrete implementation of push() |
716 | |
717 | - :param _override_hook_source_branch: If specified, run the hooks |
718 | + Args: |
719 | + _override_hook_source_branch: If specified, run the hooks |
720 | passing this Branch as the source, rather than self. This is for |
721 | use of RemoteBranch, where push is delegated to the underlying |
722 | vfs-based Branch. |
723 | @@ -2355,16 +2389,17 @@ |
724 | This function is the core worker, used by GenericInterBranch.pull to |
725 | avoid duplication when pulling source->master and source->local. |
726 | |
727 | - :param _hook_master: Private parameter - set the branch to |
728 | + Args: |
729 | + _hook_master: Private parameter - set the branch to |
730 | be supplied as the master to pull hooks. |
731 | - :param run_hooks: Private parameter - if false, this branch |
732 | - is being called because it's the master of the primary branch, |
733 | - so it should not run its hooks. |
734 | - is being called because it's the master of the primary branch, |
735 | - so it should not run its hooks. |
736 | - :param _override_hook_target: Private parameter - set the branch to be |
737 | + run_hooks: Private parameter - if false, this branch |
738 | + is being called because it's the master of the primary branch, |
739 | + so it should not run its hooks. |
740 | + is being called because it's the master of the primary branch, |
741 | + so it should not run its hooks. |
742 | + _override_hook_target: Private parameter - set the branch to be |
743 | supplied as the target_branch to pull hooks. |
744 | - :param local: Only update the local branch, and not the bound branch. |
745 | + local: Only update the local branch, and not the bound branch. |
746 | """ |
747 | # This type of branch can't be bound. |
748 | if local: |
749 | |
750 | === modified file 'breezy/bzr/fetch.py' |
751 | --- breezy/bzr/fetch.py 2020-02-18 01:57:45 +0000 |
752 | +++ breezy/bzr/fetch.py 2022-07-09 22:09:46 +0000 |
753 | @@ -14,6 +14,8 @@ |
754 | # along with this program; if not, write to the Free Software |
755 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
756 | |
757 | +__docformat__ = "google" |
758 | + |
759 | """Copying of history from one branch to another. |
760 | |
761 | The basic plan is that every branch knows the history of everything |
762 | @@ -24,16 +26,6 @@ |
763 | |
764 | import operator |
765 | |
766 | -from ..lazy_import import lazy_import |
767 | -lazy_import(globals(), """ |
768 | -from breezy import ( |
769 | - tsort, |
770 | - ) |
771 | -from breezy.bzr import ( |
772 | - versionedfile, |
773 | - vf_search, |
774 | - ) |
775 | -""") |
776 | from .. import ( |
777 | errors, |
778 | ui, |
779 | @@ -54,11 +46,12 @@ |
780 | find_ghosts=True, fetch_spec=None): |
781 | """Create a repo fetcher. |
782 | |
783 | - :param last_revision: If set, try to limit to the data this revision |
784 | + Args: |
785 | + last_revision: If set, try to limit to the data this revision |
786 | references. |
787 | - :param fetch_spec: A SearchResult specifying which revisions to fetch. |
788 | + fetch_spec: A SearchResult specifying which revisions to fetch. |
789 | If set, this overrides last_revision. |
790 | - :param find_ghosts: If True search the entire history for ghosts. |
791 | + find_ghosts: If True search the entire history for ghosts. |
792 | """ |
793 | # repository.fetch has the responsibility for short-circuiting |
794 | # attempts to copy between a repository and itself. |
795 | @@ -144,9 +137,11 @@ |
796 | """Determines the exact revisions needed from self.from_repository to |
797 | install self._last_revision in self.to_repository. |
798 | |
799 | - :returns: A SearchResult of some sort. (Possibly a |
800 | - PendingAncestryResult, EmptySearchResult, etc.) |
801 | + Returns: |
802 | + A SearchResult of some sort. (Possibly a |
803 | + PendingAncestryResult, EmptySearchResult, etc.) |
804 | """ |
805 | + from . import vf_search |
806 | if self._fetch_spec is not None: |
807 | # The fetch spec is already a concrete search result. |
808 | return self._fetch_spec |
809 | @@ -177,7 +172,8 @@ |
810 | def __init__(self, source): |
811 | """Constructor. |
812 | |
813 | - :param source: The repository data comes from |
814 | + Args: |
815 | + source: The repository data comes from |
816 | """ |
817 | self.source = source |
818 | |
819 | @@ -189,7 +185,8 @@ |
820 | Trees are retrieved in batches of 100, and then yielded in the order |
821 | they were requested. |
822 | |
823 | - :param revs: A list of revision ids |
824 | + Args: |
825 | + revs: A list of revision ids |
826 | """ |
827 | # In case that revs is not a list. |
828 | revs = list(revs) |
829 | @@ -220,11 +217,13 @@ |
830 | def generate_root_texts(self, revs): |
831 | """Generate VersionedFiles for all root ids. |
832 | |
833 | - :param revs: the revisions to include |
834 | + Args: |
835 | + revs: the revisions to include |
836 | """ |
837 | + from ..tsort import topo_sort |
838 | graph = self.source.get_graph() |
839 | parent_map = graph.get_parent_map(revs) |
840 | - rev_order = tsort.topo_sort(parent_map) |
841 | + rev_order = topo_sort(parent_map) |
842 | rev_id_to_root_id = self._find_root_ids(revs, parent_map, graph) |
843 | root_id_order = [(rev_id_to_root_id[rev_id], rev_id) for rev_id in |
844 | rev_order] |
845 | @@ -247,21 +246,22 @@ |
846 | |
847 | Used in fetches that do rich-root upgrades. |
848 | |
849 | - :param root_keys_to_create: iterable of (root_id, rev_id) pairs describing |
850 | + Args: |
851 | + root_keys_to_create: iterable of (root_id, rev_id) pairs describing |
852 | the root entries to create. |
853 | - :param rev_id_to_root_id_map: dict of known rev_id -> root_id mappings for |
854 | + rev_id_to_root_id_map: dict of known rev_id -> root_id mappings for |
855 | calculating the parents. If a parent rev_id is not found here then it |
856 | will be recalculated. |
857 | - :param parent_map: a parent map for all the revisions in |
858 | + parent_map: a parent map for all the revisions in |
859 | root_keys_to_create. |
860 | - :param graph: a graph to use instead of repo.get_graph(). |
861 | + graph: a graph to use instead of repo.get_graph(). |
862 | """ |
863 | + from .versionedfile import ChunkedContentFactory |
864 | for root_key in root_keys_to_create: |
865 | root_id, rev_id = root_key |
866 | parent_keys = _parent_keys_for_root_version( |
867 | root_id, rev_id, rev_id_to_root_id_map, parent_map, repo, graph) |
868 | - yield versionedfile.ChunkedContentFactory( |
869 | - root_key, parent_keys, None, []) |
870 | + yield ChunkedContentFactory(root_key, parent_keys, None, []) |
871 | |
872 | |
873 | def _parent_keys_for_root_version( |
874 | @@ -351,12 +351,13 @@ |
875 | * target is stacked? (similar to pre-existing target repo: even if |
876 | the target itself is new don't want to refetch existing revs) |
877 | |
878 | - :ivar source_branch: the source branch if one specified, else None. |
879 | - :ivar source_branch_stop_revision_id: fetch up to this revision of |
880 | + Attributes: |
881 | + source_branch: the source branch if one specified, else None. |
882 | + source_branch_stop_revision_id: fetch up to this revision of |
883 | source_branch, rather than its tip. |
884 | - :ivar source_repo: the source repository if one found, else None. |
885 | - :ivar target_repo: the target repository acquired by sprout. |
886 | - :ivar target_repo_kind: one of the TargetRepoKinds constants. |
887 | + source_repo: the source repository if one found, else None. |
888 | + target_repo: the target repository acquired by sprout. |
889 | + target_repo_kind: one of the TargetRepoKinds constants. |
890 | """ |
891 | |
892 | def __init__(self): |
893 | @@ -374,6 +375,7 @@ |
894 | |
895 | def make_fetch_spec(self): |
896 | """Build a SearchResult or PendingAncestryResult or etc.""" |
897 | + from . import vf_search |
898 | if self.target_repo_kind is None or self.source_repo is None: |
899 | raise AssertionError( |
900 | 'Incomplete FetchSpecFactory: %r' % (self.__dict__,)) |
901 | |
902 | === modified file 'breezy/bzr/groupcompress.py' |
903 | --- breezy/bzr/groupcompress.py 2022-01-09 13:12:27 +0000 |
904 | +++ breezy/bzr/groupcompress.py 2022-07-09 22:09:46 +0000 |
905 | @@ -22,18 +22,13 @@ |
906 | from ..lazy_import import lazy_import |
907 | lazy_import(globals(), """ |
908 | from breezy import ( |
909 | - annotate, |
910 | - config, |
911 | debug, |
912 | osutils, |
913 | static_tuple, |
914 | - trace, |
915 | tsort, |
916 | ) |
917 | from breezy.bzr import ( |
918 | knit, |
919 | - pack, |
920 | - pack_repo, |
921 | ) |
922 | |
923 | from breezy.i18n import gettext |
924 | @@ -41,6 +36,7 @@ |
925 | |
926 | from .. import ( |
927 | errors, |
928 | + trace, |
929 | ) |
930 | from .btree_index import BTreeBuilder |
931 | from ..lru_cache import LRUSizeCache |
932 | @@ -1094,6 +1090,8 @@ |
933 | :param delta: Delta compress contents. |
934 | :param keylength: How long should keys be. |
935 | """ |
936 | + from .pack import ContainerWriter |
937 | + from .pack_repo import _DirectPackAccess |
938 | def factory(transport): |
939 | parents = graph |
940 | ref_length = 0 |
941 | @@ -1102,12 +1100,12 @@ |
942 | graph_index = BTreeBuilder(reference_lists=ref_length, |
943 | key_elements=keylength) |
944 | stream = transport.open_write_stream('newpack') |
945 | - writer = pack.ContainerWriter(stream.write) |
946 | + writer = ContainerWriter(stream.write) |
947 | writer.begin() |
948 | index = _GCGraphIndex(graph_index, lambda: True, parents=parents, |
949 | add_callback=graph_index.add_nodes, |
950 | inconsistency_fatal=inconsistency_fatal) |
951 | - access = pack_repo._DirectPackAccess({}) |
952 | + access = _DirectPackAccess({}) |
953 | access.set_writer(writer, graph_index, (transport, 'newpack')) |
954 | result = GroupCompressVersionedFiles(index, access, delta) |
955 | result.stream = stream |
956 | @@ -1368,11 +1366,12 @@ |
957 | |
958 | def annotate(self, key): |
959 | """See VersionedFiles.annotate.""" |
960 | - ann = annotate.Annotator(self) |
961 | + ann = self.get_annotator() |
962 | return ann.annotate_flat(key) |
963 | |
964 | def get_annotator(self): |
965 | - return annotate.Annotator(self) |
966 | + from ..annotate import Annotator |
967 | + return Annotator(self) |
968 | |
969 | def check(self, progress_bar=None, keys=None): |
970 | """See VersionedFiles.check().""" |
971 | @@ -1700,11 +1699,12 @@ |
972 | pass |
973 | |
974 | def _get_compressor_settings(self): |
975 | + from ..config import GlobalConfig |
976 | if self._max_bytes_to_index is None: |
977 | # TODO: VersionedFiles don't know about their containing |
978 | # repository, so they don't have much of an idea about their |
979 | # location. So for now, this is only a global option. |
980 | - c = config.GlobalConfig() |
981 | + c = GlobalConfig() |
982 | val = c.get_user_option('bzr.groupcompress.max_bytes_to_index') |
983 | if val is not None: |
984 | try: |
985 | |
986 | === modified file 'breezy/commands.py' |
987 | --- breezy/commands.py 2022-07-02 13:44:01 +0000 |
988 | +++ breezy/commands.py 2022-07-09 22:09:46 +0000 |
989 | @@ -21,6 +21,8 @@ |
990 | |
991 | # TODO: Specific "examples" property on commands for consistent formatting. |
992 | |
993 | +__docformat__ = "google" |
994 | + |
995 | import contextlib |
996 | import os |
997 | import sys |
998 | @@ -29,6 +31,7 @@ |
999 | i18n, |
1000 | option, |
1001 | osutils, |
1002 | + trace, |
1003 | ) |
1004 | |
1005 | from .lazy_import import lazy_import |
1006 | @@ -39,7 +42,6 @@ |
1007 | from breezy import ( |
1008 | cmdline, |
1009 | debug, |
1010 | - trace, |
1011 | ui, |
1012 | ) |
1013 | """) |
1014 | @@ -92,7 +94,8 @@ |
1015 | class CommandRegistry(registry.Registry): |
1016 | """Special registry mapping command names to command classes. |
1017 | |
1018 | - :ivar overridden_registry: Look in this registry for commands being |
1019 | + Attributes: |
1020 | + overridden_registry: Look in this registry for commands being |
1021 | overridden by this registry. This can be used to tell plugin commands |
1022 | about the builtin they're decorating. |
1023 | """ |
1024 | @@ -117,8 +120,9 @@ |
1025 | def register(self, cmd, decorate=False): |
1026 | """Utility function to help register a command |
1027 | |
1028 | - :param cmd: Command subclass to register |
1029 | - :param decorate: If true, allow overriding an existing command |
1030 | + Args: |
1031 | + cmd: Command subclass to register |
1032 | + decorate: If true, allow overriding an existing command |
1033 | of the same name; the old command is returned by this function. |
1034 | Otherwise it is an error to try to override an existing command. |
1035 | """ |
1036 | @@ -150,9 +154,10 @@ |
1037 | def register_lazy(self, command_name, aliases, module_name): |
1038 | """Register a command without loading its module. |
1039 | |
1040 | - :param command_name: The primary name of the command. |
1041 | - :param aliases: A list of aliases for the command. |
1042 | - :module_name: The module that the command lives in. |
1043 | + Args: |
1044 | + command_name: The primary name of the command. |
1045 | + aliases: A list of aliases for the command. |
1046 | + module_name: The module that the command lives in. |
1047 | """ |
1048 | key = self._get_name(command_name) |
1049 | registry.Registry.register_lazy(self, key, module_name, command_name, |
1050 | @@ -247,8 +252,10 @@ |
1051 | def guess_command(cmd_name): |
1052 | """Guess what command a user typoed. |
1053 | |
1054 | - :param cmd_name: Command to search for |
1055 | - :return: None if no command was found, name of a command otherwise |
1056 | + Args: |
1057 | + cmd_name: Command to search for |
1058 | + Returns: |
1059 | + None if no command was found, name of a command otherwise |
1060 | """ |
1061 | names = set() |
1062 | for name in all_command_names(): |
1063 | @@ -306,12 +313,17 @@ |
1064 | def _get_cmd_object(cmd_name, plugins_override=True, check_missing=True): |
1065 | """Get a command object. |
1066 | |
1067 | - :param cmd_name: The name of the command. |
1068 | - :param plugins_override: Allow plugins to override builtins. |
1069 | - :param check_missing: Look up commands not found in the regular index via |
1070 | + Args: |
1071 | + cmd_name: The name of the command. |
1072 | + plugins_override: Allow plugins to override builtins. |
1073 | + check_missing: Look up commands not found in the regular index via |
1074 | the get_missing_command hook. |
1075 | - :return: A Command object instance |
1076 | - :raises KeyError: If no command is found. |
1077 | + |
1078 | + Returns: |
1079 | + A Command object instance |
1080 | + |
1081 | + Raises: |
1082 | + KeyError: If no command is found. |
1083 | """ |
1084 | # We want only 'ascii' command names, but the user may have typed |
1085 | # in a Unicode name. In that case, they should just get a |
1086 | @@ -357,9 +369,14 @@ |
1087 | def probe_for_provider(cmd_name): |
1088 | """Look for a provider for cmd_name. |
1089 | |
1090 | - :param cmd_name: The command name. |
1091 | - :return: plugin_metadata, provider for getting cmd_name. |
1092 | - :raises NoPluginAvailable: When no provider can supply the plugin. |
1093 | + Args: |
1094 | + cmd_name: The command name. |
1095 | + |
1096 | + Returns: |
1097 | + plugin_metadata, provider for getting cmd_name. |
1098 | + |
1099 | + Raises: |
1100 | + NoPluginAvailable: When no provider can supply the plugin. |
1101 | """ |
1102 | # look for providers that provide this command but aren't installed |
1103 | for provider in command_providers_registry: |
1104 | @@ -423,9 +440,10 @@ |
1105 | summary, then a complete description of the command. A grammar |
1106 | description will be inserted. |
1107 | |
1108 | - :cvar aliases: Other accepted names for this command. |
1109 | + Attributes: |
1110 | + aliases: Other accepted names for this command. |
1111 | |
1112 | - :cvar takes_args: List of argument forms, marked with whether they are |
1113 | + takes_args: List of argument forms, marked with whether they are |
1114 | optional, repeated, etc. Examples:: |
1115 | |
1116 | ['to_location', 'from_branch?', 'file*'] |
1117 | @@ -434,14 +452,14 @@ |
1118 | * 'from_branch' is optional |
1119 | * 'file' can be specified 0 or more times |
1120 | |
1121 | - :cvar takes_options: List of options that may be given for this command. |
1122 | + takes_options: List of options that may be given for this command. |
1123 | These can be either strings, referring to globally-defined options, or |
1124 | option objects. Retrieve through options(). |
1125 | |
1126 | - :cvar hidden: If true, this command isn't advertised. This is typically |
1127 | + hidden: If true, this command isn't advertised. This is typically |
1128 | for commands intended for expert users. |
1129 | |
1130 | - :cvar encoding_type: Command objects will get a 'outf' attribute, which has |
1131 | + encoding_type: Command objects will get a 'outf' attribute, which has |
1132 | been setup to properly handle encoding of unicode strings. |
1133 | encoding_type determines what will happen when characters cannot be |
1134 | encoded: |
1135 | @@ -455,14 +473,14 @@ |
1136 | encoding_type = 'exact', then sys.stdout is forced to be a binary |
1137 | stream, and line-endings will not mangled. |
1138 | |
1139 | - :cvar invoked_as: |
1140 | + invoked_as: |
1141 | A string indicating the real name under which this command was |
1142 | invoked, before expansion of aliases. |
1143 | (This may be None if the command was constructed and run in-process.) |
1144 | |
1145 | - :cvar hooks: An instance of CommandHooks. |
1146 | + hooks: An instance of CommandHooks. |
1147 | |
1148 | - :cvar __doc__: The help shown by 'brz help command' for this command. |
1149 | + __doc__: The help shown by 'brz help command' for this command. |
1150 | This is set by assigning explicitly to __doc__ so that -OO can |
1151 | be used:: |
1152 | |
1153 | @@ -531,13 +549,14 @@ |
1154 | see_also_as_links=False, verbose=True): |
1155 | """Return a text string with help for this command. |
1156 | |
1157 | - :param additional_see_also: Additional help topics to be |
1158 | + Args: |
1159 | + additional_see_also: Additional help topics to be |
1160 | cross-referenced. |
1161 | - :param plain: if False, raw help (reStructuredText) is |
1162 | + plain: if False, raw help (reStructuredText) is |
1163 | returned instead of plain text. |
1164 | - :param see_also_as_links: if True, convert items in 'See also' |
1165 | + see_also_as_links: if True, convert items in 'See also' |
1166 | list to internal links (used by bzr_man rstx generator) |
1167 | - :param verbose: if True, display the full help, otherwise |
1168 | + verbose: if True, display the full help, otherwise |
1169 | leave out the descriptive sections and just display |
1170 | usage help (e.g. Purpose, Usage, Options) with a |
1171 | message explaining how to obtain full help. |
1172 | @@ -694,8 +713,12 @@ |
1173 | |
1174 | The list is derived from the content of the _see_also attribute. Any |
1175 | duplicates are removed and the result is in lexical order. |
1176 | - :param additional_terms: Additional help topics to cross-reference. |
1177 | - :return: A list of help topics. |
1178 | + |
1179 | + Args: |
1180 | + additional_terms: Additional help topics to cross-reference. |
1181 | + |
1182 | + Returns: |
1183 | + A list of help topics. |
1184 | """ |
1185 | see_also = set(getattr(self, '_see_also', [])) |
1186 | if additional_terms: |
1187 | @@ -1060,18 +1083,21 @@ |
1188 | def run_bzr(argv, load_plugins=load_plugins, disable_plugins=disable_plugins): |
1189 | """Execute a command. |
1190 | |
1191 | - :param argv: The command-line arguments, without the program name from |
1192 | + Args: |
1193 | + argv: The command-line arguments, without the program name from |
1194 | argv[0] These should already be decoded. All library/test code calling |
1195 | run_bzr should be passing valid strings (don't need decoding). |
1196 | - :param load_plugins: What function to call when triggering plugin loading. |
1197 | + load_plugins: What function to call when triggering plugin loading. |
1198 | This function should take no arguments and cause all plugins to be |
1199 | loaded. |
1200 | - :param disable_plugins: What function to call when disabling plugin |
1201 | + disable_plugins: What function to call when disabling plugin |
1202 | loading. This function should take no arguments and cause all plugin |
1203 | loading to be prohibited (so that code paths in your application that |
1204 | know about some plugins possibly being present will fail to import |
1205 | those plugins even if they are installed.) |
1206 | - :return: Returns a command exit code or raises an exception. |
1207 | + |
1208 | + Returns: |
1209 | + Returns a command exit code or raises an exception. |
1210 | |
1211 | Special master options: these must come before the command because |
1212 | they control how the command is interpreted. |
1213 | @@ -1273,12 +1299,14 @@ |
1214 | |
1215 | Typically `breezy.initialize` should be called first. |
1216 | |
1217 | - :param argv: list of unicode command-line arguments similar to sys.argv. |
1218 | + Args: |
1219 | + argv: list of unicode command-line arguments similar to sys.argv. |
1220 | argv[0] is script name usually, it will be ignored. |
1221 | Don't pass here sys.argv because this list contains plain strings |
1222 | and not unicode; pass None instead. |
1223 | |
1224 | - :return: exit code of brz command. |
1225 | + Returns: |
1226 | + exit code of brz command. |
1227 | """ |
1228 | if argv is not None: |
1229 | argv = argv[1:] |
1230 | @@ -1328,9 +1356,12 @@ |
1231 | def get_topics(self, topic): |
1232 | """Search for topic amongst commands. |
1233 | |
1234 | - :param topic: A topic to search for. |
1235 | - :return: A list which is either empty or contains a single |
1236 | - Command entry. |
1237 | + Args: |
1238 | + topic: A topic to search for. |
1239 | + |
1240 | + Returns: |
1241 | + A list which is either empty or contains a single |
1242 | + Command entry. |
1243 | """ |
1244 | if topic and topic.startswith(self.prefix): |
1245 | topic = topic[len(self.prefix):] |
1246 | |
1247 | === modified file 'breezy/filters/__init__.py' |
1248 | --- breezy/filters/__init__.py 2022-07-02 13:44:01 +0000 |
1249 | +++ breezy/filters/__init__.py 2022-07-09 22:09:46 +0000 |
1250 | @@ -14,6 +14,8 @@ |
1251 | # along with this program; if not, write to the Free Software |
1252 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1253 | |
1254 | +__docformat__ = "google" |
1255 | + |
1256 | """Working tree content filtering support. |
1257 | |
1258 | A filter consists of a read converter, write converter pair. |
1259 | @@ -55,8 +57,9 @@ |
1260 | def __init__(self, reader, writer): |
1261 | """Create a filter that converts content while reading and writing. |
1262 | |
1263 | - :param reader: function for converting convenience to canonical content |
1264 | - :param writer: function for converting canonical to convenience content |
1265 | + Args: |
1266 | + reader: function for converting convenience to canonical content |
1267 | + writer: function for converting canonical to convenience content |
1268 | """ |
1269 | self.reader = reader |
1270 | self.writer = writer |
1271 | @@ -71,9 +74,10 @@ |
1272 | def __init__(self, relpath=None, tree=None): |
1273 | """Create a context. |
1274 | |
1275 | - :param relpath: the relative path or None if this context doesn't |
1276 | + Args: |
1277 | + relpath: the relative path or None if this context doesn't |
1278 | support that information. |
1279 | - :param tree: the Tree providing this file or None if this context |
1280 | + tree: the Tree providing this file or None if this context |
1281 | doesn't support that information. |
1282 | """ |
1283 | self._relpath = relpath |
1284 | @@ -113,9 +117,11 @@ |
1285 | def filtered_input_file(f, filters): |
1286 | """Get an input file that converts external to internal content. |
1287 | |
1288 | - :param f: the original input file |
1289 | - :param filters: the stack of filters to apply |
1290 | - :return: a file-like object, size |
1291 | + Args: |
1292 | + f: the original input file |
1293 | + filters: the stack of filters to apply |
1294 | + |
1295 | + Returns: a file-like object, size |
1296 | """ |
1297 | chunks = [f.read()] |
1298 | for filter in filters: |
1299 | @@ -128,11 +134,13 @@ |
1300 | def filtered_output_bytes(chunks, filters, context=None): |
1301 | """Convert byte chunks from internal to external format. |
1302 | |
1303 | - :param chunks: an iterator containing the original content |
1304 | - :param filters: the stack of filters to apply |
1305 | - :param context: a ContentFilterContext object passed to |
1306 | + Args: |
1307 | + chunks: an iterator containing the original content |
1308 | + filters: the stack of filters to apply |
1309 | + context: a ContentFilterContext object passed to |
1310 | each filter |
1311 | - :return: an iterator containing the content to output |
1312 | + |
1313 | + Returns: an iterator containing the content to output |
1314 | """ |
1315 | if filters: |
1316 | for filter in reversed(filters): |
1317 | @@ -144,8 +152,9 @@ |
1318 | def internal_size_sha_file_byname(name, filters): |
1319 | """Get size and sha of internal content given external content. |
1320 | |
1321 | - :param name: path to file |
1322 | - :param filters: the stack of filters to apply |
1323 | + Args: |
1324 | + name: path to file |
1325 | + filters: the stack of filters to apply |
1326 | """ |
1327 | with open(name, 'rb', 65000) as f: |
1328 | if filters: |
1329 | @@ -181,10 +190,11 @@ |
1330 | def _get_filter_stack_for(preferences): |
1331 | """Get the filter stack given a sequence of preferences. |
1332 | |
1333 | - :param preferences: a sequence of (name,value) tuples where |
1334 | - name is the preference name and |
1335 | - value is the key into the filter stack map registered |
1336 | - for that preference. |
1337 | + Args: |
1338 | + preferences: a sequence of (name,value) tuples where |
1339 | + name is the preference name and |
1340 | + value is the key into the filter stack map registered |
1341 | + for that preference. |
1342 | """ |
1343 | if preferences is None: |
1344 | return [] |
1345 | @@ -216,8 +226,11 @@ |
1346 | # run tests |
1347 | _reset_registry(old) |
1348 | |
1349 | - :param value: the value to set the registry to or None for an empty one. |
1350 | - :return: the existing value before it reset. |
1351 | + Args: |
1352 | + value: the value to set the registry to or None for an empty one. |
1353 | + |
1354 | + Returns: |
1355 | + the existing value before it reset. |
1356 | """ |
1357 | global filter_stacks_registry |
1358 | original = filter_stacks_registry |
1359 | |
1360 | === modified file 'breezy/option.py' |
1361 | --- breezy/option.py 2020-06-23 01:02:30 +0000 |
1362 | +++ breezy/option.py 2022-07-09 22:09:46 +0000 |
1363 | @@ -17,6 +17,8 @@ |
1364 | # TODO: For things like --diff-prefix, we want a way to customize the display |
1365 | # of the option argument. |
1366 | |
1367 | +__docformat__ = "google" |
1368 | + |
1369 | import optparse |
1370 | import re |
1371 | |
1372 | @@ -136,8 +138,9 @@ |
1373 | class Option(object): |
1374 | """Description of a command line option |
1375 | |
1376 | - :ivar _short_name: If this option has a single-letter name, this is it. |
1377 | - Otherwise None. |
1378 | + Attributes: |
1379 | + _short_name: If this option has a single-letter name, this is it. |
1380 | + Otherwise None. |
1381 | """ |
1382 | |
1383 | # The dictionary of standard options. These are always legal. |
1384 | @@ -153,27 +156,22 @@ |
1385 | hidden=False): |
1386 | """Make a new command option. |
1387 | |
1388 | - :param name: regular name of the command, used in the double-dash |
1389 | + Args: |
1390 | + name: regular name of the command, used in the double-dash |
1391 | form and also as the parameter to the command's run() |
1392 | method (unless param_name is specified). |
1393 | - |
1394 | - :param help: help message displayed in command help |
1395 | - |
1396 | - :param type: function called to parse the option argument, or |
1397 | + help: help message displayed in command help |
1398 | + type: function called to parse the option argument, or |
1399 | None (default) if this option doesn't take an argument. |
1400 | - |
1401 | - :param argname: name of option argument, if any |
1402 | - |
1403 | - :param short_name: short option code for use with a single -, e.g. |
1404 | + argname: name of option argument, if any |
1405 | + short_name: short option code for use with a single -, e.g. |
1406 | short_name="v" to enable parsing of -v. |
1407 | - |
1408 | - :param param_name: name of the parameter which will be passed to |
1409 | + param_name: name of the parameter which will be passed to |
1410 | the command's run() method. |
1411 | - |
1412 | - :param custom_callback: a callback routine to be called after normal |
1413 | + custom_callback: a callback routine to be called after normal |
1414 | processing. The signature of the callback routine is |
1415 | (option, name, new_value, parser). |
1416 | - :param hidden: If True, the option should be hidden in help and |
1417 | + hidden: If True, the option should be hidden in help and |
1418 | documentation. |
1419 | """ |
1420 | self.name = name |
1421 | @@ -323,20 +321,21 @@ |
1422 | """ |
1423 | Constructor. |
1424 | |
1425 | - :param name: The option name. |
1426 | - :param help: Help for the option. |
1427 | - :param registry: A Registry containing the values |
1428 | - :param converter: Callable to invoke with the value name to produce |
1429 | + Args: |
1430 | + name: The option name. |
1431 | + help: Help for the option. |
1432 | + registry: A Registry containing the values |
1433 | + converter: Callable to invoke with the value name to produce |
1434 | the value. If not supplied, self.registry.get is used. |
1435 | - :param value_switches: If true, each possible value is assigned its |
1436 | + value_switches: If true, each possible value is assigned its |
1437 | own switch. For example, instead of '--format knit', |
1438 | '--knit' can be used interchangeably. |
1439 | - :param enum_switch: If true, a switch is provided with the option name, |
1440 | + enum_switch: If true, a switch is provided with the option name, |
1441 | which takes a value. |
1442 | - :param lazy_registry: A tuple of (module name, attribute name) for a |
1443 | + lazy_registry: A tuple of (module name, attribute name) for a |
1444 | registry to be lazily loaded. |
1445 | - :param short_name: The short name for the enum switch, if any |
1446 | - :param short_value_switches: A dict mapping values to short names |
1447 | + short_name: The short name for the enum switch, if any |
1448 | + short_value_switches: A dict mapping values to short names |
1449 | """ |
1450 | Option.__init__(self, name, help, type=self.convert, |
1451 | short_name=short_name) |
1452 | |
1453 | === modified file 'breezy/plugin.py' |
1454 | --- breezy/plugin.py 2022-07-08 22:26:28 +0000 |
1455 | +++ breezy/plugin.py 2022-07-09 22:09:46 +0000 |
1456 | @@ -14,6 +14,8 @@ |
1457 | # along with this program; if not, write to the Free Software |
1458 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1459 | |
1460 | +__docformat__ = "google" |
1461 | + |
1462 | """Breezy plugin support. |
1463 | |
1464 | Which plugins to load can be configured by setting these environment variables: |
1465 | @@ -58,7 +60,8 @@ |
1466 | |
1467 | Future calls to load_plugins() will be ignored. |
1468 | |
1469 | - :param state: The library state object that records loaded plugins. |
1470 | + Args: |
1471 | + state: The library state object that records loaded plugins. |
1472 | """ |
1473 | if state is None: |
1474 | state = breezy.get_global_state() |
1475 | @@ -73,9 +76,10 @@ |
1476 | files (and whatever other extensions are used in the platform, |
1477 | such as `*.pyd`). |
1478 | |
1479 | - :param path: The list of paths to search for plugins. By default, |
1480 | + Args: |
1481 | + path: The list of paths to search for plugins. By default, |
1482 | it is populated from the __path__ of the breezy.plugins package. |
1483 | - :param state: The library state object that records loaded plugins. |
1484 | + state: The library state object that records loaded plugins. |
1485 | """ |
1486 | if state is None: |
1487 | state = breezy.get_global_state() |
1488 | @@ -342,9 +346,12 @@ |
1489 | |
1490 | Includes both those that have loaded, and those that failed to load. |
1491 | |
1492 | - :param show_paths: If true, include the plugin path. |
1493 | - :param state: The library state object to inspect. |
1494 | - :returns: Iterator of text lines (including newlines.) |
1495 | + Args: |
1496 | + show_paths: If true, include the plugin path. |
1497 | + state: The library state object to inspect. |
1498 | + |
1499 | + Returns: |
1500 | + Iterator of text lines (including newlines.) |
1501 | """ |
1502 | if state is None: |
1503 | state = breezy.get_global_state() |
1504 | @@ -425,8 +432,9 @@ |
1505 | def _load_plugin_module(name, dir): |
1506 | """Load plugin by name. |
1507 | |
1508 | - :param name: The plugin name in the breezy.plugins namespace. |
1509 | - :param dir: The directory the plugin is loaded from for error messages. |
1510 | + Args: |
1511 | + name: The plugin name in the breezy.plugins namespace. |
1512 | + dir: The directory the plugin is loaded from for error messages. |
1513 | """ |
1514 | if _MODULE_PREFIX + name in sys.modules: |
1515 | return |
1516 | @@ -497,9 +505,12 @@ |
1517 | |
1518 | This will not trigger loading of new plugins. |
1519 | |
1520 | - :param topic: A topic to search for. |
1521 | - :return: A list which is either empty or contains a single |
1522 | - RegisteredTopic entry. |
1523 | + Args: |
1524 | + topic: A topic to search for. |
1525 | + |
1526 | + Returns: |
1527 | + A list which is either empty or contains a single |
1528 | + RegisteredTopic entry. |
1529 | """ |
1530 | if not topic: |
1531 | return [] |
1532 | @@ -520,14 +531,16 @@ |
1533 | def __init__(self, module): |
1534 | """Constructor. |
1535 | |
1536 | - :param module: The module for which help should be generated. |
1537 | + Args: |
1538 | + module: The module for which help should be generated. |
1539 | """ |
1540 | self.module = module |
1541 | |
1542 | def get_help_text(self, additional_see_also=None, verbose=True): |
1543 | """Return a string with the help for this topic. |
1544 | |
1545 | - :param additional_see_also: Additional help topics to be |
1546 | + Args: |
1547 | + additional_see_also: Additional help topics to be |
1548 | cross-referenced. |
1549 | """ |
1550 | from . import help_topics |
1551 | @@ -585,7 +598,8 @@ |
1552 | def load_plugin_tests(self, loader): |
1553 | """Return the adapted plugin's test suite. |
1554 | |
1555 | - :param loader: The custom loader that should be used to load additional |
1556 | + Args: |
1557 | + loader: The custom loader that should be used to load additional |
1558 | tests. |
1559 | """ |
1560 | if getattr(self.module, 'load_tests', None) is not None: |
1561 | |
1562 | === modified file 'breezy/repository.py' |
1563 | --- breezy/repository.py 2022-07-02 13:44:01 +0000 |
1564 | +++ breezy/repository.py 2022-07-09 22:09:46 +0000 |
1565 | @@ -14,6 +14,8 @@ |
1566 | # along with this program; if not, write to the Free Software |
1567 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1568 | |
1569 | +__docformat__ = "google" |
1570 | + |
1571 | from .lazy_import import lazy_import |
1572 | lazy_import(globals(), """ |
1573 | import time |
1574 | @@ -61,8 +63,9 @@ |
1575 | class FetchResult(object): |
1576 | """Result of a fetch operation. |
1577 | |
1578 | - :ivar revidmap: For lossy fetches, map from source revid to target revid. |
1579 | - :ivar total_fetched: Number of revisions fetched |
1580 | + Attributes: |
1581 | + revidmap: For lossy fetches, map from source revid to target revid. |
1582 | + total_fetched: Number of revisions fetched |
1583 | """ |
1584 | |
1585 | def __init__(self, total_fetched=None, revidmap=None): |
1586 | @@ -88,14 +91,15 @@ |
1587 | revision_id=None, lossy=False): |
1588 | """Initiate a CommitBuilder. |
1589 | |
1590 | - :param repository: Repository to commit to. |
1591 | - :param parents: Revision ids of the parents of the new revision. |
1592 | - :param timestamp: Optional timestamp recorded for commit. |
1593 | - :param timezone: Optional timezone for timestamp. |
1594 | - :param committer: Optional committer to set for commit. |
1595 | - :param revprops: Optional dictionary of revision properties. |
1596 | - :param revision_id: Optional revision id. |
1597 | - :param lossy: Whether to discard data that can not be natively |
1598 | + Args: |
1599 | + repository: Repository to commit to. |
1600 | + parents: Revision ids of the parents of the new revision. |
1601 | + timestamp: Optional timestamp recorded for commit. |
1602 | + timezone: Optional timezone for timestamp. |
1603 | + committer: Optional committer to set for commit. |
1604 | + revprops: Optional dictionary of revision properties. |
1605 | + revision_id: Optional revision id. |
1606 | + lossy: Whether to discard data that can not be natively |
1607 | represented, when pushing to a foreign VCS |
1608 | """ |
1609 | self._config_stack = config_stack |
1610 | @@ -134,7 +138,7 @@ |
1611 | This includes merge-only changes. It is the core for the --unchanged |
1612 | detection in commit. |
1613 | |
1614 | - :return: True if any changes have occured. |
1615 | + Returns: True if any changes have occured. |
1616 | """ |
1617 | raise NotImplementedError(self.any_changes) |
1618 | |
1619 | @@ -158,7 +162,7 @@ |
1620 | def commit(self, message): |
1621 | """Make the actual commit. |
1622 | |
1623 | - :return: The revision id of the recorded revision. |
1624 | + Returns: The revision id of the recorded revision. |
1625 | """ |
1626 | raise NotImplementedError(self.commit) |
1627 | |
1628 | @@ -181,7 +185,7 @@ |
1629 | def finish_inventory(self): |
1630 | """Tell the builder that the inventory is finished. |
1631 | |
1632 | - :return: The inventory id in the repository, which can be used with |
1633 | + Returns: The inventory id in the repository, which can be used with |
1634 | repository.get_inventory. |
1635 | """ |
1636 | raise NotImplementedError(self.finish_inventory) |
1637 | @@ -193,7 +197,8 @@ |
1638 | they should override this function and raise CannotSetRevisionId |
1639 | if _new_revision_id is not None. |
1640 | |
1641 | - :raises: CannotSetRevisionId |
1642 | + Raises: |
1643 | + CannotSetRevisionId |
1644 | """ |
1645 | if not self.repository._format.supports_setting_revision_ids: |
1646 | if revision_id is not None: |
1647 | @@ -209,15 +214,16 @@ |
1648 | def record_iter_changes(self, tree, basis_revision_id, iter_changes): |
1649 | """Record a new tree via iter_changes. |
1650 | |
1651 | - :param tree: The tree to obtain text contents from for changed objects. |
1652 | - :param basis_revision_id: The revision id of the tree the iter_changes |
1653 | + Args: |
1654 | + tree: The tree to obtain text contents from for changed objects. |
1655 | + basis_revision_id: The revision id of the tree the iter_changes |
1656 | has been generated against. Currently assumed to be the same |
1657 | as self.parents[0] - if it is not, errors may occur. |
1658 | - :param iter_changes: An iter_changes iterator with the changes to apply |
1659 | + iter_changes: An iter_changes iterator with the changes to apply |
1660 | to basis_revision_id. The iterator must not include any items with |
1661 | a current kind of None - missing items must be either filtered out |
1662 | or errored-on beefore record_iter_changes sees the item. |
1663 | - :return: A generator of (relpath, fs_hash) tuples for use with |
1664 | + Returns: A generator of (relpath, fs_hash) tuples for use with |
1665 | tree._observed_sha1. |
1666 | """ |
1667 | raise NotImplementedError(self.record_iter_changes) |
1668 | @@ -226,9 +232,10 @@ |
1669 | class RepositoryWriteLockResult(LogicalLockResult): |
1670 | """The result of write locking a repository. |
1671 | |
1672 | - :ivar repository_token: The token obtained from the underlying lock, or |
1673 | + Attributes: |
1674 | + repository_token: The token obtained from the underlying lock, or |
1675 | None. |
1676 | - :ivar unlock: A callable which will unlock the lock. |
1677 | + unlock: A callable which will unlock the lock. |
1678 | """ |
1679 | |
1680 | def __init__(self, unlock, repository_token): |
1681 | @@ -284,11 +291,10 @@ |
1682 | def abort_write_group(self, suppress_errors=False): |
1683 | """Commit the contents accrued within the current write group. |
1684 | |
1685 | - :param suppress_errors: if true, abort_write_group will catch and log |
1686 | + Args: |
1687 | + suppress_errors: if true, abort_write_group will catch and log |
1688 | unexpected errors that happen during the abort, rather than |
1689 | allowing them to propagate. Defaults to False. |
1690 | - |
1691 | - :seealso: start_write_group. |
1692 | """ |
1693 | if self._write_group is not self.get_transaction(): |
1694 | # has an unlock or relock occured ? |
1695 | @@ -327,7 +333,8 @@ |
1696 | def add_fallback_repository(self, repository): |
1697 | """Add a repository to use for looking up data not held locally. |
1698 | |
1699 | - :param repository: A repository. |
1700 | + Args: |
1701 | + repository: A repository. |
1702 | """ |
1703 | raise NotImplementedError(self.add_fallback_repository) |
1704 | |
1705 | @@ -336,7 +343,8 @@ |
1706 | |
1707 | Raise an error if not. |
1708 | |
1709 | - :param repository: A repository to fallback to. |
1710 | + Args: |
1711 | + repository: A repository to fallback to. |
1712 | """ |
1713 | return InterRepository._assert_same_model(self, repository) |
1714 | |
1715 | @@ -376,9 +384,10 @@ |
1716 | def __init__(self, _format, controldir, control_files): |
1717 | """instantiate a Repository. |
1718 | |
1719 | - :param _format: The format of the repository on disk. |
1720 | - :param controldir: The ControlDir of the repository. |
1721 | - :param control_files: Control files to use for locking, etc. |
1722 | + Args: |
1723 | + _format: The format of the repository on disk. |
1724 | + controldir: The ControlDir of the repository. |
1725 | + control_files: Control files to use for locking, etc. |
1726 | """ |
1727 | # In the future we will have a single api for all stores for |
1728 | # getting file texts, inventories and revisions, then |
1729 | @@ -460,15 +469,20 @@ |
1730 | |
1731 | XXX: this docstring is duplicated in many places, e.g. lockable_files.py |
1732 | |
1733 | - :param token: if this is already locked, then lock_write will fail |
1734 | + Args: |
1735 | + token: if this is already locked, then lock_write will fail |
1736 | unless the token matches the existing lock. |
1737 | - :returns: a token if this instance supports tokens, otherwise None. |
1738 | - :raises TokenLockingNotSupported: when a token is given but this |
1739 | + Returns: |
1740 | + a token if this instance supports tokens, otherwise None. |
1741 | + |
1742 | + Raises: |
1743 | + TokenLockingNotSupported: when a token is given but this |
1744 | instance doesn't support using token locks. |
1745 | - :raises MismatchedToken: if the specified token doesn't match the token |
1746 | + MismatchedToken: if the specified token doesn't match the token |
1747 | of the existing lock. |
1748 | - :seealso: start_write_group. |
1749 | - :return: A RepositoryWriteLockResult. |
1750 | + |
1751 | + Returns: |
1752 | + A RepositoryWriteLockResult. |
1753 | """ |
1754 | locked = self.is_locked() |
1755 | token = self.control_files.lock_write(token=token) |
1756 | @@ -484,7 +498,7 @@ |
1757 | def lock_read(self): |
1758 | """Lock the repository for read operations. |
1759 | |
1760 | - :return: An object with an unlock method which will release the lock |
1761 | + Returns: An object with an unlock method which will release the lock |
1762 | obtained. |
1763 | """ |
1764 | locked = self.is_locked() |
1765 | @@ -519,11 +533,12 @@ |
1766 | def gather_stats(self, revid=None, committers=None): |
1767 | """Gather statistics from a revision id. |
1768 | |
1769 | - :param revid: The revision id to gather statistics from, if None, then |
1770 | + Args: |
1771 | + revid: The revision id to gather statistics from, if None, then |
1772 | no revision specific statistics are gathered. |
1773 | - :param committers: Optional parameter controlling whether to grab |
1774 | + committers: Optional parameter controlling whether to grab |
1775 | a count of committers from the revision specific statistics. |
1776 | - :return: A dictionary of statistics. Currently this contains: |
1777 | + Returns: A dictionary of statistics. Currently this contains: |
1778 | committers: The number of committers if requested. |
1779 | firstrev: A tuple with timestamp, timezone for the penultimate left |
1780 | most ancestor of revid, if revid is not the NULL_REVISION. |
1781 | @@ -565,7 +580,8 @@ |
1782 | |
1783 | This will include branches inside other branches. |
1784 | |
1785 | - :param using: If True, list only branches using this repository. |
1786 | + Args: |
1787 | + using: If True, list only branches using this repository. |
1788 | """ |
1789 | if using and not self.is_shared(): |
1790 | for branch in self.controldir.list_branches(): |
1791 | @@ -637,7 +653,7 @@ |
1792 | |
1793 | :seealso: start_write_group. |
1794 | |
1795 | - :return: it may return an opaque hint that can be passed to 'pack'. |
1796 | + Returns: it may return an opaque hint that can be passed to 'pack'. |
1797 | """ |
1798 | if self._write_group is not self.get_transaction(): |
1799 | # has an unlock or relock occured ? |
1800 | @@ -660,9 +676,12 @@ |
1801 | def suspend_write_group(self): |
1802 | """Suspend a write group. |
1803 | |
1804 | - :raise UnsuspendableWriteGroup: If the write group can not be |
1805 | + Raises: |
1806 | + UnsuspendableWriteGroup: If the write group can not be |
1807 | suspended. |
1808 | - :return: List of tokens |
1809 | + |
1810 | + Returns: |
1811 | + List of tokens |
1812 | """ |
1813 | raise errors.UnsuspendableWriteGroup(self) |
1814 | |
1815 | @@ -700,13 +719,14 @@ |
1816 | either finish the current write group before using fetch, or use |
1817 | fetch before starting the write group. |
1818 | |
1819 | - :param find_ghosts: Find and copy revisions in the source that are |
1820 | + Args: |
1821 | + find_ghosts: Find and copy revisions in the source that are |
1822 | ghosts in the target (and not reachable directly by walking out to |
1823 | the first-present revision in target from revision_id). |
1824 | - :param revision_id: If specified, all the content needed for this |
1825 | + revision_id: If specified, all the content needed for this |
1826 | revision ID will be copied to the target. Fetch will determine for |
1827 | itself which content needs to be copied. |
1828 | - :return: A FetchResult object |
1829 | + Returns: A FetchResult object |
1830 | """ |
1831 | if self.is_in_write_group(): |
1832 | raise errors.InternalBzrError( |
1833 | @@ -731,15 +751,16 @@ |
1834 | revision_id=None, lossy=False): |
1835 | """Obtain a CommitBuilder for this repository. |
1836 | |
1837 | - :param branch: Branch to commit to. |
1838 | - :param parents: Revision ids of the parents of the new revision. |
1839 | - :param config_stack: Configuration stack to use. |
1840 | - :param timestamp: Optional timestamp recorded for commit. |
1841 | - :param timezone: Optional timezone for timestamp. |
1842 | - :param committer: Optional committer to set for commit. |
1843 | - :param revprops: Optional dictionary of revision properties. |
1844 | - :param revision_id: Optional revision id. |
1845 | - :param lossy: Whether to discard data that can not be natively |
1846 | + Args: |
1847 | + branch: Branch to commit to. |
1848 | + parents: Revision ids of the parents of the new revision. |
1849 | + config_stack: Configuration stack to use. |
1850 | + timestamp: Optional timestamp recorded for commit. |
1851 | + timezone: Optional timezone for timestamp. |
1852 | + committer: Optional committer to set for commit. |
1853 | + revprops: Optional dictionary of revision properties. |
1854 | + revision_id: Optional revision id. |
1855 | + lossy: Whether to discard data that can not be natively |
1856 | represented, when pushing to a foreign VCS |
1857 | """ |
1858 | raise NotImplementedError(self.get_commit_builder) |
1859 | @@ -764,7 +785,7 @@ |
1860 | Currently no check is made that the format of this repository and |
1861 | the bzrdir format are compatible. FIXME RBC 20060201. |
1862 | |
1863 | - :return: The newly created destination repository. |
1864 | + Returns: The newly created destination repository. |
1865 | """ |
1866 | with self.lock_read(): |
1867 | # TODO: deprecate after 0.16; cloning this with all its settings is |
1868 | @@ -787,7 +808,7 @@ |
1869 | |
1870 | One can only insert data into a repository inside a write group. |
1871 | |
1872 | - :return: None. |
1873 | + Returns: None. |
1874 | """ |
1875 | if not self.is_write_locked(): |
1876 | raise errors.NotWriteLocked(self) |
1877 | @@ -837,8 +858,9 @@ |
1878 | def has_revisions(self, revision_ids): |
1879 | """Probe to find out the presence of multiple revisions. |
1880 | |
1881 | - :param revision_ids: An iterable of revision_ids. |
1882 | - :return: A set of the revision_ids that were present. |
1883 | + Args: |
1884 | + revision_ids: An iterable of revision_ids. |
1885 | + Returns: A set of the revision_ids that were present. |
1886 | """ |
1887 | raise NotImplementedError(self.has_revisions) |
1888 | |
1889 | @@ -873,11 +895,12 @@ |
1890 | def iter_revisions(self, revision_ids): |
1891 | """Iterate over revision objects. |
1892 | |
1893 | - :param revision_ids: An iterable of revisions to examine. None may be |
1894 | + Args: |
1895 | + revision_ids: An iterable of revisions to examine. None may be |
1896 | passed to request all revisions known to the repository. Note that |
1897 | not all repositories can find unreferenced revisions; for those |
1898 | repositories only referenced ones will be returned. |
1899 | - :return: An iterator of (revid, revision) tuples. Absent revisions ( |
1900 | + Returns: An iterator of (revid, revision) tuples. Absent revisions ( |
1901 | those asked for but not available) are returned as (revid, None). |
1902 | N.B.: Revisions are not necessarily yielded in order. |
1903 | """ |
1904 | @@ -902,7 +925,8 @@ |
1905 | |
1906 | specific_files should exist in the first revision. |
1907 | |
1908 | - :param specific_files: if not None, the result is filtered |
1909 | + Args: |
1910 | + specific_files: if not None, the result is filtered |
1911 | so that only those files, their parents and their |
1912 | children are included. |
1913 | """ |
1914 | @@ -937,8 +961,9 @@ |
1915 | def add_signature_text(self, revision_id, signature): |
1916 | """Store a signature text for a revision. |
1917 | |
1918 | - :param revision_id: Revision id of the revision |
1919 | - :param signature: Signature text. |
1920 | + Args: |
1921 | + revision_id: Revision id of the revision |
1922 | + signature: Signature text. |
1923 | """ |
1924 | raise NotImplementedError(self.add_signature_text) |
1925 | |
1926 | @@ -953,7 +978,8 @@ |
1927 | uniquely identify the file version in the caller's context. (Examples: |
1928 | an index number or a TreeTransform trans_id.) |
1929 | |
1930 | - :param desired_files: a list of (file_id, revision_id, identifier) |
1931 | + Args: |
1932 | + desired_files: a list of (file_id, revision_id, identifier) |
1933 | triples |
1934 | """ |
1935 | raise NotImplementedError(self.iter_files_bytes) |
1936 | @@ -962,7 +988,7 @@ |
1937 | """Return the revision id of a revno, given a later (revno, revid) |
1938 | pair in the same history. |
1939 | |
1940 | - :return: if found (True, revid). If the available history ran out |
1941 | + Returns: if found (True, revid). If the available history ran out |
1942 | before reaching the revno, then this returns |
1943 | (False, (closest_revno, closest_revid)). |
1944 | """ |
1945 | @@ -1023,7 +1049,8 @@ |
1946 | def revision_trees(self, revision_ids): |
1947 | """Return Trees for revisions in this repository. |
1948 | |
1949 | - :param revision_ids: a sequence of revision-ids; |
1950 | + Args: |
1951 | + revision_ids: a sequence of revision-ids; |
1952 | a revision-id may not be None or b'null:' |
1953 | """ |
1954 | raise NotImplementedError(self.revision_trees) |
1955 | @@ -1038,14 +1065,15 @@ |
1956 | self.write_lock as this is a long running call it's reasonable to |
1957 | implicitly lock for the user. |
1958 | |
1959 | - :param hint: If not supplied, the whole repository is packed. |
1960 | + Args: |
1961 | + hint: If not supplied, the whole repository is packed. |
1962 | If supplied, the repository may use the hint parameter as a |
1963 | hint for the parts of the repository to pack. A hint can be |
1964 | obtained from the result of commit_write_group(). Out of |
1965 | date hints are simply ignored, because concurrent operations |
1966 | can obsolete them rapidly. |
1967 | |
1968 | - :param clean_obsolete_packs: Clean obsolete packs immediately after |
1969 | + clean_obsolete_packs: Clean obsolete packs immediately after |
1970 | the pack operation. |
1971 | """ |
1972 | |
1973 | @@ -1114,7 +1142,9 @@ |
1974 | This only applies to branches that use this repository. |
1975 | |
1976 | The default is 'True'. |
1977 | - :param new_value: True to restore the default, False to disable making |
1978 | + |
1979 | + Args: |
1980 | + new_value: True to restore the default, False to disable making |
1981 | working trees. |
1982 | """ |
1983 | raise NotImplementedError(self.set_make_working_trees) |
1984 | @@ -1129,19 +1159,23 @@ |
1985 | def verify_revision_signature(self, revision_id, gpg_strategy): |
1986 | """Verify the signature on a revision. |
1987 | |
1988 | - :param revision_id: the revision to verify |
1989 | - :gpg_strategy: the GPGStrategy object to used |
1990 | + Args: |
1991 | + revision_id: the revision to verify |
1992 | + gpg_strategy: the GPGStrategy object to used |
1993 | |
1994 | - :return: gpg.SIGNATURE_VALID or a failed SIGNATURE_ value |
1995 | + Returns: gpg.SIGNATURE_VALID or a failed SIGNATURE_ value |
1996 | """ |
1997 | raise NotImplementedError(self.verify_revision_signature) |
1998 | |
1999 | def verify_revision_signatures(self, revision_ids, gpg_strategy): |
2000 | """Verify revision signatures for a number of revisions. |
2001 | |
2002 | - :param revision_id: the revision to verify |
2003 | - :gpg_strategy: the GPGStrategy object to used |
2004 | - :return: Iterator over tuples with revision id, result and keys |
2005 | + Args: |
2006 | + revision_id: the revision to verify |
2007 | + gpg_strategy: the GPGStrategy object to used |
2008 | + |
2009 | + Returns: |
2010 | + Iterator over tuples with revision id, result and keys |
2011 | """ |
2012 | with self.lock_read(): |
2013 | for revid in revision_ids: |
2014 | @@ -1161,12 +1195,13 @@ |
2015 | |
2016 | Different repository implementations should override _check(). |
2017 | |
2018 | - :param revision_ids: A non-empty list of revision_ids whose ancestry |
2019 | + Args: |
2020 | + revision_ids: A non-empty list of revision_ids whose ancestry |
2021 | will be checked. Typically the last revision_id of a branch. |
2022 | - :param callback_refs: A dict of check-refs to resolve and callback |
2023 | + callback_refs: A dict of check-refs to resolve and callback |
2024 | the check/_check method on the items listed as wanting the ref. |
2025 | see breezy.check. |
2026 | - :param check_repo: If False do not check the repository contents, just |
2027 | + check_repo: If False do not check the repository contents, just |
2028 | calculate the data callback_refs requires and call them back. |
2029 | """ |
2030 | return self._check(revision_ids=revision_ids, callback_refs=callback_refs, |
2031 | @@ -1349,9 +1384,12 @@ |
2032 | def initialize(self, controldir, shared=False): |
2033 | """Initialize a repository of this format in controldir. |
2034 | |
2035 | - :param controldir: The controldir to put the new repository in it. |
2036 | - :param shared: The repository should be initialized as a sharable one. |
2037 | - :returns: The new repository object. |
2038 | + Args: |
2039 | + controldir: The controldir to put the new repository in it. |
2040 | + shared: The repository should be initialized as a sharable one. |
2041 | + |
2042 | + Returns: |
2043 | + The new repository object. |
2044 | |
2045 | This may raise UninitializableFormat if shared repository are not |
2046 | compatible the controldir. |
2047 | @@ -1522,7 +1560,8 @@ |
2048 | This is a destructive operation! Do not use it on existing |
2049 | repositories. |
2050 | |
2051 | - :param revision_id: Only copy the content needed to construct |
2052 | + Args: |
2053 | + revision_id: Only copy the content needed to construct |
2054 | revision_id and its parents. |
2055 | """ |
2056 | with self.lock_write(): |
2057 | @@ -1538,9 +1577,10 @@ |
2058 | |
2059 | The content is copied from self.source to self.target. |
2060 | |
2061 | - :param revision_id: if None all content is copied, if NULL_REVISION no |
2062 | + Args: |
2063 | + revision_id: if None all content is copied, if NULL_REVISION no |
2064 | content is copied. |
2065 | - :return: FetchResult |
2066 | + Returns: FetchResult |
2067 | """ |
2068 | raise NotImplementedError(self.fetch) |
2069 | |
2070 | @@ -1549,18 +1589,19 @@ |
2071 | limit=None): |
2072 | """Return the revision ids that source has that target does not. |
2073 | |
2074 | - :param revision_ids: return revision ids included by these |
2075 | + Args: |
2076 | + revision_ids: return revision ids included by these |
2077 | revision_ids. NoSuchRevision will be raised if any of these |
2078 | revisions are not present. |
2079 | - :param if_present_ids: like revision_ids, but will not cause |
2080 | + if_present_ids: like revision_ids, but will not cause |
2081 | NoSuchRevision if any of these are absent, instead they will simply |
2082 | not be in the result. This is useful for e.g. finding revisions |
2083 | to fetch for tags, which may reference absent revisions. |
2084 | - :param find_ghosts: If True find missing revisions in deep history |
2085 | + find_ghosts: If True find missing revisions in deep history |
2086 | rather than just finding the surface difference. |
2087 | - :param limit: Maximum number of revisions to return, topologically |
2088 | + limit: Maximum number of revisions to return, topologically |
2089 | ordered |
2090 | - :return: A breezy.graph.SearchResult. |
2091 | + Returns: A breezy.graph.SearchResult. |
2092 | """ |
2093 | raise NotImplementedError(self.search_missing_revision_ids) |
2094 | |
2095 | @@ -1598,15 +1639,17 @@ |
2096 | def __init__(self, target_format): |
2097 | """Create a CopyConverter. |
2098 | |
2099 | - :param target_format: The format the resulting repository should be. |
2100 | + Args: |
2101 | + target_format: The format the resulting repository should be. |
2102 | """ |
2103 | self.target_format = target_format |
2104 | |
2105 | def convert(self, repo, pb): |
2106 | """Perform the conversion of to_convert, giving feedback via pb. |
2107 | |
2108 | - :param to_convert: The disk object to convert. |
2109 | - :param pb: a progress bar to use for progress information. |
2110 | + Args: |
2111 | + to_convert: The disk object to convert. |
2112 | + pb: a progress bar to use for progress information. |
2113 | """ |
2114 | with ui.ui_factory.nested_progress_bar() as pb: |
2115 | self.count = 0 |
2116 | @@ -1654,9 +1697,10 @@ |
2117 | encountered. Otherwise, stop when the beginning of history is |
2118 | reached. |
2119 | |
2120 | - :param stop_index: The index which should be present. When it is |
2121 | + Args: |
2122 | + stop_index: The index which should be present. When it is |
2123 | present, history extension will stop. |
2124 | - :param stop_revision: The revision id which should be present. When |
2125 | + stop_revision: The revision id which should be present. When |
2126 | it is encountered, history extension will stop. |
2127 | """ |
2128 | start_revision = partial_history_cache[-1] |
2129 | |
2130 | === modified file 'breezy/workingtree.py' |
2131 | --- breezy/workingtree.py 2022-07-09 22:09:46 +0000 |
2132 | +++ breezy/workingtree.py 2022-07-09 22:09:46 +0000 |
2133 | @@ -41,13 +41,13 @@ |
2134 | import stat |
2135 | |
2136 | from breezy import ( |
2137 | - revision as _mod_revision, |
2138 | views, |
2139 | ) |
2140 | """) |
2141 | |
2142 | from . import ( |
2143 | errors, |
2144 | + revision as _mod_revision, |
2145 | ) |
2146 | from .controldir import ( |
2147 | ControlComponent, |
Voting criteria not met /ci.breezy- vcs.org/ job/brz/ job/brz- land/985/
https:/