basstler-stack 4.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- basstler/maintenance/__init__.py +0 -0
- basstler/maintenance/__main__.py +128 -0
- basstler/maintenance/board.py +113 -0
- basstler/maintenance/check_overview.py +80 -0
- basstler/maintenance/commands.py +595 -0
- basstler/maintenance/default_branch_sync.py +444 -0
- basstler/maintenance/exceptions.py +36 -0
- basstler/maintenance/fast_forward.py +223 -0
- basstler/maintenance/finish_summary.py +515 -0
- basstler/maintenance/fork_pull_request_action.py +38 -0
- basstler/maintenance/landed_closing.py +85 -0
- basstler/maintenance/landed_closing_follow_up.py +85 -0
- basstler/maintenance/promotion.py +248 -0
- basstler/maintenance/promotion_context.py +221 -0
- basstler/maintenance/report.py +304 -0
- basstler/maintenance/restack_procedure.py +279 -0
- basstler/maintenance/restack_steps.py +769 -0
- basstler/maintenance/upstream_pull_request_synchronization.py +189 -0
- basstler/maintenance/upstream_read_route.py +37 -0
- basstler/stack/__init__.py +0 -0
- basstler/stack/__main__.py +377 -0
- basstler/stack/branch_status.py +54 -0
- basstler/stack/checkout.py +416 -0
- basstler/stack/commit_move.py +218 -0
- basstler/stack/exceptions.py +233 -0
- basstler/stack/label_write.py +68 -0
- basstler/stack/merge_probe.py +195 -0
- basstler/stack/model.py +696 -0
- basstler/stack/promotability.py +103 -0
- basstler/stack/promotion_link.py +138 -0
- basstler/stack/report.py +304 -0
- basstler/stack/settings.py +453 -0
- basstler/stack/stack.toml +31 -0
- basstler_stack-4.2.0.dist-info/METADATA +16 -0
- basstler_stack-4.2.0.dist-info/RECORD +38 -0
- basstler_stack-4.2.0.dist-info/WHEEL +4 -0
- basstler_stack-4.2.0.dist-info/licenses/LICENSE +202 -0
- basstler_stack-4.2.0.dist-info/licenses/NOTICE +13 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Which settings a checkout runs on, and which of its remotes are the fork and the
|
|
3
|
+
upstream.
|
|
4
|
+
|
|
5
|
+
``stack.toml`` carries the shipped defaults (label names, the base branch); the
|
|
6
|
+
project's committed ``.claude/basstler/stack.toml`` names its upstream, and a
|
|
7
|
+
``.claude/personal/stack.toml`` on the personal-notes branch, if present, layers per-
|
|
8
|
+
user overrides on top of both.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import tomllib
|
|
14
|
+
from collections.abc import Mapping
|
|
15
|
+
from dataclasses import dataclass
|
|
16
|
+
from enum import StrEnum
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
from basstler.github.repository import HasRepository, Repository
|
|
20
|
+
from basstler.github.stack_configuration import (
|
|
21
|
+
CommittedStackConfiguration,
|
|
22
|
+
StackSetting,
|
|
23
|
+
)
|
|
24
|
+
from basstler.locations import PackageLocation, ProjectLocation
|
|
25
|
+
from basstler.shell_configuration import (
|
|
26
|
+
FetchedBranchReference,
|
|
27
|
+
ShellConfigurationFunction,
|
|
28
|
+
)
|
|
29
|
+
from basstler.stack.checkout import CurrentCheckout, GitArgument
|
|
30
|
+
from basstler.stack.exceptions import (
|
|
31
|
+
AmbiguousForkRemoteError,
|
|
32
|
+
ForkRemoteNotFoundError,
|
|
33
|
+
OwnRemoteNotFoundError,
|
|
34
|
+
)
|
|
35
|
+
from basstler.standard_streams import StandardStreamHandler
|
|
36
|
+
|
|
37
|
+
logger = StandardStreamHandler.logger_for(__name__)
|
|
38
|
+
"""
|
|
39
|
+
This module's logger, which is also what its command prints through.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
# %% configuration
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
class Remote(HasRepository):
|
|
47
|
+
"""
|
|
48
|
+
A git remote, identified by the repository its URL names rather than by its name.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
name: str
|
|
52
|
+
"""
|
|
53
|
+
What this checkout calls the remote.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
class LayeredStackSettings:
|
|
59
|
+
"""
|
|
60
|
+
The stack settings this checkout runs on: the shipped defaults and the project's
|
|
61
|
+
settings, with any personal-notes overrides layered on top.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
defaults: Path = PackageLocation.STACK_CONFIGURATION.value
|
|
65
|
+
"""
|
|
66
|
+
The shipped defaults file.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
def values(self) -> dict[str, str]:
|
|
70
|
+
""":return: The layered values."""
|
|
71
|
+
values = CommittedStackConfiguration(self.defaults).values()
|
|
72
|
+
values.update(self._personal_overrides())
|
|
73
|
+
return values
|
|
74
|
+
|
|
75
|
+
@staticmethod
|
|
76
|
+
def _personal_overrides() -> dict[str, object]:
|
|
77
|
+
"""
|
|
78
|
+
Fetch the personal-notes branch and parse its configuration override file, if
|
|
79
|
+
any.
|
|
80
|
+
|
|
81
|
+
The shell configuration's own fetch function decides which remote and branch the
|
|
82
|
+
notes are on, so this and the hook scripts can never disagree about it.
|
|
83
|
+
|
|
84
|
+
:return: The parsed contents of :attr:`ProjectLocation.PERSONAL_STACK_CONFIGURATION`
|
|
85
|
+
on the personal-notes branch, or an empty mapping if the branch or the file
|
|
86
|
+
doesn't exist (e.g. before it has ever been written).
|
|
87
|
+
"""
|
|
88
|
+
if ShellConfigurationFunction.FETCH_PERSONAL_NOTES_BRANCH.run().returncode != 0:
|
|
89
|
+
return {}
|
|
90
|
+
fetched_file = FetchedBranchReference.PERSONAL_NOTES.file_at(
|
|
91
|
+
ProjectLocation.PERSONAL_STACK_CONFIGURATION
|
|
92
|
+
)
|
|
93
|
+
if not CurrentCheckout.succeeds(
|
|
94
|
+
GitArgument.CAT_FILE, GitArgument.EXISTS, fetched_file
|
|
95
|
+
):
|
|
96
|
+
return {}
|
|
97
|
+
return tomllib.loads(CurrentCheckout.output(GitArgument.SHOW, fetched_file))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass(frozen=True)
|
|
101
|
+
class RemoteResolution:
|
|
102
|
+
"""
|
|
103
|
+
Which remote is the fork and which is the upstream, decided without trusting names.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
fork: Remote
|
|
107
|
+
"""
|
|
108
|
+
The remote holding the stack.
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
upstream: Remote | None
|
|
112
|
+
"""
|
|
113
|
+
The remote for the upstream review repository, absent if the checkout has none.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
upstream_repository: Repository
|
|
117
|
+
"""
|
|
118
|
+
The upstream, whether or not a remote points at it yet.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
preferred_upstream_name: str
|
|
122
|
+
"""
|
|
123
|
+
What the upstream's tracking references are kept under when no remote points at it.
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def upstream_name(self) -> str:
|
|
128
|
+
"""
|
|
129
|
+
:return: The upstream remote's name, or :attr:`preferred_upstream_name` when the
|
|
130
|
+
checkout has no remote for it.
|
|
131
|
+
"""
|
|
132
|
+
return self.upstream.name if self.upstream else self.preferred_upstream_name
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def upstream_location(self) -> str:
|
|
136
|
+
"""
|
|
137
|
+
:return: What the upstream is fetched from: its remote's name, or its URL when
|
|
138
|
+
the checkout has no remote for it.
|
|
139
|
+
"""
|
|
140
|
+
return (
|
|
141
|
+
self.upstream.name if self.upstream else self.upstream_repository.clone_url
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
@classmethod
|
|
145
|
+
def resolve(
|
|
146
|
+
cls,
|
|
147
|
+
remote_urls: Mapping[str, str],
|
|
148
|
+
upstream_repository: Repository,
|
|
149
|
+
preferred_upstream_name: str,
|
|
150
|
+
fork_repository: Repository | None = None,
|
|
151
|
+
) -> RemoteResolution:
|
|
152
|
+
"""
|
|
153
|
+
Decide which remote is the fork and which is the upstream.
|
|
154
|
+
|
|
155
|
+
Remotes are matched by the repository their URL names, so a checkout whose
|
|
156
|
+
remotes are called anything at all resolves the same way.
|
|
157
|
+
|
|
158
|
+
:param remote_urls: Remote name to URL, as git reports them.
|
|
159
|
+
:param upstream_repository: The repository every fork is forked from.
|
|
160
|
+
:param preferred_upstream_name: What to call the upstream remote if one must be
|
|
161
|
+
added.
|
|
162
|
+
:param fork_repository: The fork, when configuration names it outright.
|
|
163
|
+
:return: The resolved remotes.
|
|
164
|
+
:raises ForkRemoteNotFoundError: If no remote points at a fork.
|
|
165
|
+
:raises AmbiguousForkRemoteError: If several do and configuration does not
|
|
166
|
+
disambiguate.
|
|
167
|
+
"""
|
|
168
|
+
remotes = [
|
|
169
|
+
Remote(repository=Repository.from_remote_url(url), name=name)
|
|
170
|
+
for name, url in remote_urls.items()
|
|
171
|
+
if Repository.names_a_repository(url)
|
|
172
|
+
]
|
|
173
|
+
upstream = next(
|
|
174
|
+
(remote for remote in remotes if remote.repository == upstream_repository),
|
|
175
|
+
None,
|
|
176
|
+
)
|
|
177
|
+
candidates = tuple(
|
|
178
|
+
remote for remote in remotes if remote.repository != upstream_repository
|
|
179
|
+
)
|
|
180
|
+
return cls(
|
|
181
|
+
fork=cls._select_fork(candidates, fork_repository, upstream_repository),
|
|
182
|
+
upstream=upstream,
|
|
183
|
+
upstream_repository=upstream_repository,
|
|
184
|
+
preferred_upstream_name=preferred_upstream_name,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
@classmethod
|
|
188
|
+
def of_checkout(
|
|
189
|
+
cls,
|
|
190
|
+
path: Path = PackageLocation.STACK_CONFIGURATION.value,
|
|
191
|
+
fork_repository: Repository | None = None,
|
|
192
|
+
upstream_repository: Repository | None = None,
|
|
193
|
+
) -> RemoteResolution:
|
|
194
|
+
"""
|
|
195
|
+
Resolve this checkout's fork and upstream remotes.
|
|
196
|
+
|
|
197
|
+
:param path: The committed defaults file.
|
|
198
|
+
:param fork_repository: The fork, when the caller already knows it.
|
|
199
|
+
:param upstream_repository: The upstream, when the caller already knows it.
|
|
200
|
+
:return: The resolved remotes.
|
|
201
|
+
:raises ForkRemoteNotFoundError: If no remote points at a fork.
|
|
202
|
+
:raises AmbiguousForkRemoteError: If several do and nothing names which one it
|
|
203
|
+
is.
|
|
204
|
+
"""
|
|
205
|
+
values = LayeredStackSettings(path).values()
|
|
206
|
+
configured_fork = values.get(StackSetting.FORK_REPOSITORY)
|
|
207
|
+
return cls.resolve(
|
|
208
|
+
CurrentCheckout.remote_urls(),
|
|
209
|
+
upstream_repository
|
|
210
|
+
or CommittedStackConfiguration(path).upstream_repository_in(
|
|
211
|
+
values, ProjectLocation.PERSONAL_STACK_CONFIGURATION.value
|
|
212
|
+
),
|
|
213
|
+
values[StackSetting.UPSTREAM_REMOTE],
|
|
214
|
+
fork_repository
|
|
215
|
+
or (Repository.parse(configured_fork) if configured_fork else None),
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
@staticmethod
|
|
219
|
+
def _select_fork(
|
|
220
|
+
candidates: tuple[Remote, ...],
|
|
221
|
+
fork_repository: Repository | None,
|
|
222
|
+
upstream_repository: Repository,
|
|
223
|
+
) -> Remote:
|
|
224
|
+
"""
|
|
225
|
+
Pick the fork from the remotes that are not the upstream.
|
|
226
|
+
|
|
227
|
+
:param candidates: The non-upstream remotes.
|
|
228
|
+
:param fork_repository: The fork, when configuration names it outright.
|
|
229
|
+
:param upstream_repository: The upstream, for reporting when nothing qualifies.
|
|
230
|
+
:return: The fork's remote.
|
|
231
|
+
:raises ForkRemoteNotFoundError: If no candidate qualifies.
|
|
232
|
+
:raises AmbiguousForkRemoteError: If several do and configuration does not
|
|
233
|
+
disambiguate.
|
|
234
|
+
"""
|
|
235
|
+
if fork_repository:
|
|
236
|
+
named = [
|
|
237
|
+
remote for remote in candidates if remote.repository == fork_repository
|
|
238
|
+
]
|
|
239
|
+
if not named:
|
|
240
|
+
raise ForkRemoteNotFoundError(upstream_repository)
|
|
241
|
+
return named[0]
|
|
242
|
+
if not candidates:
|
|
243
|
+
raise ForkRemoteNotFoundError(upstream_repository)
|
|
244
|
+
if len(candidates) > 1:
|
|
245
|
+
raise AmbiguousForkRemoteError(candidates)
|
|
246
|
+
return candidates[0]
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
@dataclass
|
|
250
|
+
class Configuration:
|
|
251
|
+
"""
|
|
252
|
+
Everything this checkout runs on: the layered settings and the remotes they resolve
|
|
253
|
+
to.
|
|
254
|
+
"""
|
|
255
|
+
|
|
256
|
+
in_review_label: str
|
|
257
|
+
"""
|
|
258
|
+
Fork pull request label marking a branch as promoted to the upstream and under
|
|
259
|
+
review.
|
|
260
|
+
"""
|
|
261
|
+
|
|
262
|
+
rebase_label: str
|
|
263
|
+
"""
|
|
264
|
+
Fork pull request label opting a branch into the rebase strategy instead of the
|
|
265
|
+
default merge.
|
|
266
|
+
"""
|
|
267
|
+
|
|
268
|
+
needs_resolution_label: str
|
|
269
|
+
"""
|
|
270
|
+
Fork pull request label marking a branch withheld from promotion pending conflict
|
|
271
|
+
resolution.
|
|
272
|
+
"""
|
|
273
|
+
|
|
274
|
+
fork_repository: Repository
|
|
275
|
+
"""
|
|
276
|
+
The fork that holds the full stack, as GitHub names it.
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
fork_remote: str
|
|
280
|
+
"""
|
|
281
|
+
Git remote for the fork that holds the full stack.
|
|
282
|
+
"""
|
|
283
|
+
|
|
284
|
+
upstream_repository: Repository | None
|
|
285
|
+
"""
|
|
286
|
+
The repository every fork is forked from, and the only one constant across
|
|
287
|
+
contributors; ``None`` for a project that is not a fork, whose own remote is its
|
|
288
|
+
base.
|
|
289
|
+
"""
|
|
290
|
+
|
|
291
|
+
upstream_remote: str
|
|
292
|
+
"""
|
|
293
|
+
The name the upstream's tracking references are kept under, ``refs/remotes/<it>/``,
|
|
294
|
+
whether or not a remote of that name exists.
|
|
295
|
+
"""
|
|
296
|
+
|
|
297
|
+
upstream_base: str
|
|
298
|
+
"""
|
|
299
|
+
The upstream base branch every stack ultimately targets.
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
upstream_location: str
|
|
303
|
+
"""
|
|
304
|
+
What the upstream is fetched from: its remote's name, or its URL when the checkout
|
|
305
|
+
has no remote for it.
|
|
306
|
+
"""
|
|
307
|
+
|
|
308
|
+
@classmethod
|
|
309
|
+
def load(
|
|
310
|
+
cls,
|
|
311
|
+
path: Path = PackageLocation.STACK_CONFIGURATION.value,
|
|
312
|
+
fork_repository: Repository | None = None,
|
|
313
|
+
upstream_repository: Repository | None = None,
|
|
314
|
+
) -> Configuration:
|
|
315
|
+
"""
|
|
316
|
+
Parse the layered configuration.
|
|
317
|
+
|
|
318
|
+
Values from the shipped *path* are the defaults; the project's committed
|
|
319
|
+
``.claude/basstler/stack.toml`` overrides them, and any key present in
|
|
320
|
+
``.claude/personal/stack.toml`` on the personal-notes branch overrides both, so
|
|
321
|
+
a user's own remotes/labels never have to be hand-edited into a checked-in file.
|
|
322
|
+
A repository passed here outranks all three, so a caller that has been told
|
|
323
|
+
which repository is which never has one inferred for it.
|
|
324
|
+
|
|
325
|
+
A project that names no upstream follows its own remote instead, see
|
|
326
|
+
:meth:`following_own_remote`.
|
|
327
|
+
|
|
328
|
+
:param path: The shipped defaults file.
|
|
329
|
+
:param fork_repository: The fork, when the caller already knows it.
|
|
330
|
+
:param upstream_repository: The upstream, when the caller already knows it.
|
|
331
|
+
:return: The layered configuration.
|
|
332
|
+
"""
|
|
333
|
+
values = LayeredStackSettings(path).values()
|
|
334
|
+
upstream_repository = (
|
|
335
|
+
upstream_repository
|
|
336
|
+
or CommittedStackConfiguration.named_upstream_repository(values)
|
|
337
|
+
)
|
|
338
|
+
if upstream_repository is None:
|
|
339
|
+
return cls.following_own_remote(values)
|
|
340
|
+
resolution = RemoteResolution.of_checkout(
|
|
341
|
+
path, fork_repository, upstream_repository
|
|
342
|
+
)
|
|
343
|
+
return cls(
|
|
344
|
+
in_review_label=values[StackSetting.IN_REVIEW_LABEL],
|
|
345
|
+
rebase_label=values[StackSetting.REBASE_LABEL],
|
|
346
|
+
needs_resolution_label=values[StackSetting.NEEDS_RESOLUTION_LABEL],
|
|
347
|
+
fork_repository=resolution.fork.repository,
|
|
348
|
+
fork_remote=resolution.fork.name,
|
|
349
|
+
upstream_repository=upstream_repository,
|
|
350
|
+
upstream_remote=resolution.upstream_name,
|
|
351
|
+
upstream_base=values[StackSetting.UPSTREAM_BASE],
|
|
352
|
+
upstream_location=resolution.upstream_location,
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
@classmethod
|
|
356
|
+
def following_own_remote(cls, values: dict[str, str]) -> Configuration:
|
|
357
|
+
"""
|
|
358
|
+
:param values: Layered stack settings naming no upstream.
|
|
359
|
+
:return: The configuration of a project that is not a fork: the remote
|
|
360
|
+
:attr:`StackSetting.FORK_REMOTE` names stands where the upstream would.
|
|
361
|
+
:raises OwnRemoteNotFoundError: If the clone has no remote of that name.
|
|
362
|
+
"""
|
|
363
|
+
own_remote = values[StackSetting.FORK_REMOTE]
|
|
364
|
+
remote_urls = CurrentCheckout.remote_urls()
|
|
365
|
+
if own_remote not in remote_urls:
|
|
366
|
+
raise OwnRemoteNotFoundError(own_remote)
|
|
367
|
+
return cls(
|
|
368
|
+
in_review_label=values[StackSetting.IN_REVIEW_LABEL],
|
|
369
|
+
rebase_label=values[StackSetting.REBASE_LABEL],
|
|
370
|
+
needs_resolution_label=values[StackSetting.NEEDS_RESOLUTION_LABEL],
|
|
371
|
+
fork_repository=Repository.from_remote_url(remote_urls[own_remote]),
|
|
372
|
+
fork_remote=own_remote,
|
|
373
|
+
upstream_repository=None,
|
|
374
|
+
upstream_remote=own_remote,
|
|
375
|
+
upstream_base=values[StackSetting.UPSTREAM_BASE],
|
|
376
|
+
upstream_location=own_remote,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
@property
|
|
380
|
+
def has_upstream(self) -> bool:
|
|
381
|
+
"""
|
|
382
|
+
Whether the project is a fork whose branches are promoted to an upstream.
|
|
383
|
+
"""
|
|
384
|
+
return self.upstream_repository is not None
|
|
385
|
+
|
|
386
|
+
@classmethod
|
|
387
|
+
def location_of(
|
|
388
|
+
cls,
|
|
389
|
+
branch: str,
|
|
390
|
+
fork_location: str,
|
|
391
|
+
path: Path = PackageLocation.STACK_CONFIGURATION.value,
|
|
392
|
+
) -> str:
|
|
393
|
+
"""
|
|
394
|
+
Where *branch* is current: the upstream for the upstream base of a project that
|
|
395
|
+
names an upstream, since the fork's copy of that base can lag behind it.
|
|
396
|
+
|
|
397
|
+
:param branch: The branch to read.
|
|
398
|
+
:param fork_location: The remote name or URL any other branch is read from.
|
|
399
|
+
:param path: The shipped defaults file.
|
|
400
|
+
:return: The remote name or URL to fetch *branch* from.
|
|
401
|
+
"""
|
|
402
|
+
if StackSetting.UPSTREAM_REPOSITORY not in LayeredStackSettings(path).values():
|
|
403
|
+
return fork_location
|
|
404
|
+
configuration = cls.load(path)
|
|
405
|
+
if branch != configuration.upstream_base:
|
|
406
|
+
return fork_location
|
|
407
|
+
return configuration.upstream_location
|
|
408
|
+
|
|
409
|
+
@property
|
|
410
|
+
def upstream_base_reference(self) -> str:
|
|
411
|
+
"""
|
|
412
|
+
The upstream's base branch, as the checkout's tracking reference names it.
|
|
413
|
+
"""
|
|
414
|
+
return f"{self.upstream_remote}/{self.upstream_base}"
|
|
415
|
+
|
|
416
|
+
def reference_on_fork(self, name: str) -> str:
|
|
417
|
+
""":param name: A branch or parent name.
|
|
418
|
+
:return: Its reference on the fork remote."""
|
|
419
|
+
return f"{self.fork_remote}/{name}"
|
|
420
|
+
|
|
421
|
+
def print_settings(self) -> None:
|
|
422
|
+
"""
|
|
423
|
+
Print the resolved configuration as one ``field<TAB>value`` line per setting.
|
|
424
|
+
|
|
425
|
+
Keys are this class's own field names, so a caller reading one by name cannot be
|
|
426
|
+
reading a name this module never prints. A setting with no value is omitted
|
|
427
|
+
rather than printed empty.
|
|
428
|
+
"""
|
|
429
|
+
for name, value in vars(self).items():
|
|
430
|
+
if value is None:
|
|
431
|
+
continue
|
|
432
|
+
logger.info(f"{name}{PrintedConfiguration.FIELD_SEPARATOR}{value}")
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
class PrintedConfiguration(StrEnum):
|
|
436
|
+
"""
|
|
437
|
+
How :meth:`Configuration.print_settings` lays a setting out on its line.
|
|
438
|
+
"""
|
|
439
|
+
|
|
440
|
+
FIELD_SEPARATOR = "\t"
|
|
441
|
+
"""
|
|
442
|
+
What separates a setting's name from its value.
|
|
443
|
+
"""
|
|
444
|
+
|
|
445
|
+
@classmethod
|
|
446
|
+
def read(cls, output: str) -> dict[str, str]:
|
|
447
|
+
"""
|
|
448
|
+
Read printed configuration back into its settings.
|
|
449
|
+
|
|
450
|
+
:param output: What :meth:`Configuration.print_settings` printed.
|
|
451
|
+
:return: Each printed setting's value, by name.
|
|
452
|
+
"""
|
|
453
|
+
return dict(line.split(cls.FIELD_SEPARATOR) for line in output.splitlines())
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Stacked-PR config - the fork-staging / upstream-review workflow.
|
|
2
|
+
#
|
|
3
|
+
# This file carries the shipped defaults only, and names nobody's repository. A project
|
|
4
|
+
# names its own upstream in its committed `.claude/basstler/stack.toml`, which outranks
|
|
5
|
+
# these values, and a `.claude/personal/stack.toml` on the personal-notes branch, if present,
|
|
6
|
+
# layers per-user overrides on top of both (see `Configuration.load` in `stack/settings.py`).
|
|
7
|
+
#
|
|
8
|
+
# The stack itself (which branches exist, how they depend on each other, and their review state) is
|
|
9
|
+
# read live from GitHub, not declared here:
|
|
10
|
+
#
|
|
11
|
+
# * the dependency TREE = each fork PR's BASE branch (base = parent). Set it on GitHub.
|
|
12
|
+
# * draft <-> ready = the fork PR's draft toggle. Un-draft to approve for review.
|
|
13
|
+
# * in-review = an open upstream PR opened from the branch (read by the board
|
|
14
|
+
# export); a pass mirrors it as the `in_review_label` and a link
|
|
15
|
+
# in the fork PR's description.
|
|
16
|
+
# * merged = branch is an ancestor of `<upstream_remote>/<upstream_base>` (pure git).
|
|
17
|
+
# * needs-resolution = the `needs_resolution_label` on the fork PR (set by a maintenance pass when it
|
|
18
|
+
# delegates a restack conflict to the branch's owning session; withholds
|
|
19
|
+
# the branch from promotion until cleared).
|
|
20
|
+
|
|
21
|
+
in_review_label = "in-review" # fork-PR label a pass sets while an upstream PR is open
|
|
22
|
+
rebase_label = "rebase" # fork-PR label opting a branch into rebase instead of the default merge
|
|
23
|
+
needs_resolution_label = "needs-resolution" # set by a maintenance pass on a delegated restack conflict
|
|
24
|
+
# fork_repository: deliberately unset - the fork is derived from `fork_remote`'s URL, so this file
|
|
25
|
+
# names nobody's fork. Set it (in a personal override) only for a checkout whose fork remote is not
|
|
26
|
+
# the fork.
|
|
27
|
+
fork_remote = "origin"
|
|
28
|
+
# upstream_repository: deliberately unset - the project names it in .claude/basstler/stack.toml.
|
|
29
|
+
# A project naming none is not a fork: `fork_remote` then stands where the upstream would.
|
|
30
|
+
upstream_remote = "upstream" # name to give the upstream remote when one has to be added
|
|
31
|
+
upstream_base = "main"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: basstler-stack
|
|
3
|
+
Version: 4.2.0
|
|
4
|
+
Summary: Stacked pull request maintenance.
|
|
5
|
+
Project-URL: Source, https://github.com/KAOS-repositories/basstler
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/KAOS-repositories/basstler/issues
|
|
7
|
+
Author-email: Abdelrhman Bassiouny <bido.bassuny@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Requires-Dist: basstler-core==4.2.0
|
|
13
|
+
Requires-Dist: basstler-git==4.2.0
|
|
14
|
+
Requires-Dist: basstler-github==4.2.0
|
|
15
|
+
Requires-Dist: basstler-reviews==4.2.0
|
|
16
|
+
Requires-Dist: cyclopts>=5.3
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
basstler/maintenance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
basstler/maintenance/__main__.py,sha256=-gOy3hIPYJINU3ea0Nf43TpDjoe7UL3FatUnLQ5lSPs,5511
|
|
3
|
+
basstler/maintenance/board.py,sha256=F7_YSlgBPCFCMlu-78vAIH7rLwI9J9w3Xd_JyboZxgk,3858
|
|
4
|
+
basstler/maintenance/check_overview.py,sha256=kHqQW7HQ8diYMHTl0T5RdbLcNcAo_brJL4DF-UrRRzg,2597
|
|
5
|
+
basstler/maintenance/commands.py,sha256=Kts1mUBdkj67afneSGeXNRu_P590Reaju5ECldHowr0,21303
|
|
6
|
+
basstler/maintenance/default_branch_sync.py,sha256=CBsSdPqM9uNLm5txZ_p_5uZTZjDqjRi0RgBOPUCx-NI,14964
|
|
7
|
+
basstler/maintenance/exceptions.py,sha256=K-BpK2meBfUxHPhnSw4HTF8oPjeKi4qbAT6ZQOIEoJ8,855
|
|
8
|
+
basstler/maintenance/fast_forward.py,sha256=ANlntGKl3WDbZwsuU6y6GGFDyKpVIH90hJGd4IHAvY4,6831
|
|
9
|
+
basstler/maintenance/finish_summary.py,sha256=c1LGIBXo7F936Xu6wN7nZBkp4WKaDUGQtf_IrOuHGgs,17761
|
|
10
|
+
basstler/maintenance/fork_pull_request_action.py,sha256=KbghVk_XeE0YA9u5CY5YNugVuIALsUGW9bGjlk6U5Zk,1014
|
|
11
|
+
basstler/maintenance/landed_closing.py,sha256=zlRVYpdqVZEnGNvFxMy5_MfqWOart0vMuXw45Jz8rPw,3022
|
|
12
|
+
basstler/maintenance/landed_closing_follow_up.py,sha256=AHXeil_cDHkULpYmDH_BfKImVVConLKm93XEfe1GwS4,2539
|
|
13
|
+
basstler/maintenance/promotion.py,sha256=wdv2OAhyxw7PNESntF1SVxuvqRsdlNbqY3l6K-4MDpY,8477
|
|
14
|
+
basstler/maintenance/promotion_context.py,sha256=HmHfnkxwbLXhbIJI_9nAfwZ0O9CCWZyUZ-bKWGrTIvA,6393
|
|
15
|
+
basstler/maintenance/report.py,sha256=ah0NXcCcU69huYR88jQC2PloelcApVXmXzlUC4DIVrw,10779
|
|
16
|
+
basstler/maintenance/restack_procedure.py,sha256=oYopsqlEjQFC_OAa_z4udNhjUqIvE-5uadZdJqfZ_2U,10197
|
|
17
|
+
basstler/maintenance/restack_steps.py,sha256=hLHYwxbErhHHVu8KuvAb5YWJx9ZB3SQVh8Iso1qRQz0,28017
|
|
18
|
+
basstler/maintenance/upstream_pull_request_synchronization.py,sha256=OwwFR0YmgFXaP-vsSd5cYP-Is7O-BlJ9DnoYqoYdo20,6880
|
|
19
|
+
basstler/maintenance/upstream_read_route.py,sha256=IbEL-sBqWss6er2z_hSRIcildkMDeG5J8Qg_A59LT38,870
|
|
20
|
+
basstler/stack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
basstler/stack/__main__.py,sha256=KUCAf9Uwu3g6MZivmTcxqQCF3-qV-0awFgX9_66z2mQ,12635
|
|
22
|
+
basstler/stack/branch_status.py,sha256=NaHJ34IbJm8u5-ce4NcBV2KyrozyOkHqAVg4_-bVIVA,1486
|
|
23
|
+
basstler/stack/checkout.py,sha256=XeC0p3k5sfMgWVIbUVy-7ZLBRVSm8EgXcaYC-ikT330,11943
|
|
24
|
+
basstler/stack/commit_move.py,sha256=eWCLY4rxp05u1r0XktB46yPhSpprbx6xeVqcSV5C-TU,7499
|
|
25
|
+
basstler/stack/exceptions.py,sha256=mFoNpVmnvHQdg4hE1q7_m-AFmvpaw3SdaiDKT4z0k68,6341
|
|
26
|
+
basstler/stack/label_write.py,sha256=0F6MWBRSXzegimppOeJ4c6KjnmHM0ui5GuCMkFnwpOQ,2226
|
|
27
|
+
basstler/stack/merge_probe.py,sha256=iRjrjwM449zZPpplr-Tagd7E8y9LMbewuByPAhk-Tto,5471
|
|
28
|
+
basstler/stack/model.py,sha256=aezDfu1MiMY5KK6JTtJfffB3hGSRpT8ATfgAW5mVsl4,27053
|
|
29
|
+
basstler/stack/promotability.py,sha256=FiseEK4lRiCPBhvdGSU4yUX217MX4a23LDptEsCRHa0,2776
|
|
30
|
+
basstler/stack/promotion_link.py,sha256=tziZVwAZQURcsbstCsC3KM5t3yMmikphgJmjsL6Xw38,4642
|
|
31
|
+
basstler/stack/report.py,sha256=cpMfskyeyEH13Uh4KrDoNvOxdwKKc0_o7eVp-Y36CK4,9894
|
|
32
|
+
basstler/stack/settings.py,sha256=K2110MYkEjOrVVsFRNWPKPL1qrYjUYn-42bRllrhoRA,16075
|
|
33
|
+
basstler/stack/stack.toml,sha256=0ZuLyp5lyYNiy8NUhIk0NNnvY7JytJuV8WrM8ikE6zM,2220
|
|
34
|
+
basstler_stack-4.2.0.dist-info/METADATA,sha256=UYkXp9OoAhsdjFvJXTSMoYV6mWse9C0HW3SPXygT6KQ,582
|
|
35
|
+
basstler_stack-4.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
36
|
+
basstler_stack-4.2.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
37
|
+
basstler_stack-4.2.0.dist-info/licenses/NOTICE,sha256=dBp1KVYEzyxlNrbsD-iH86mHlxEPlBHlGoqx8R_GNDM,695
|
|
38
|
+
basstler_stack-4.2.0.dist-info/RECORD,,
|